LabelBuilder
A builder for the Label item.
Extends GenericItemBuilder
Example
import OBR, { buildLabel } from "@owlbear-rodeo/sdk";
const item = buildLabel().plainText("Test").build();
OBR.scene.local.addItems([item]);
Reference
Methods
text
text(text);
Set the texts text content.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| text | TextContent | The content of the text |
Returns the current builder.
width
width(width);
Set the texts width.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| width | TextSize | The text width |
Returns the current builder.
height
height(height);
Set the texts height.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| height | TextSize | The text height |
Returns the current builder.
plainText
plainText(plainText);
Set the texts plainText.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| plainText | string | The plain text |
Returns the current builder.
padding
padding(padding);
Set the text styles padding.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| padding | number | The text padding |
Returns the current builder.
fontFamily
fontFamily(fontFamily);
Set the text styles fontFamily.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontFamily | string | The text font family |
Returns the current builder.
fontSize
fontSize(fontSize);
Set the text styles fontSize.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontSize | number | The text font size |
Returns the current builder.
fontWeight
fontWeight(fontWeight);
Set the text styles fontWeight.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fontWeight | number | The text font weight |
Returns the current builder.
textAlign
textAlign(textAlign);
Set the text styles textAlign.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textAlign | "LEFT" | "CENTER" | "RIGHT" | The text horizontal alignment |
Returns the current builder.
textAlignVertical
textAlignVertical(textAlignVertical);
Set the text styles textAlignVertical.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| textAlignVertical | "BOTTOM" | "MIDDLE" | "TOP" | The text vertical alignment |
Returns the current builder.
fillColor
fillColor(fillColor);
Set the text styles fillColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillColor | string | The texts fill color |
Returns the current builder.
fillOpacity
fillOpacity(fillOpacity);
Set the text styles fillOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| fillOpacity | number | The texts fill opacity |
Returns the current builder.
strokeColor
strokeColor(strokeColor);
Set the text styles strokeColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeColor | string | The texts stroke color |
Returns the current builder.
strokeOpacity
strokeOpacity(strokeOpacity);
Set the text styles strokeOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeOpacity | number | The texts stroke opacity |
Returns the current builder.
strokeWidth
strokeWidth(strokeWidth);
Set the text styles strokeWidth.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| strokeWidth | number | The texts stroke width |
Returns the current builder.
lineHeight
lineHeight(lineHeight);
Set the text styles lineHeight.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| lineHeight | number | The texts line height |
Returns the current builder.
style
style(style);
Set the labels style.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| style | LabelStyle | The labels style |
Returns the current builder.
backgroundColor
backgroundColor(backgroundColor);
Set the labels styles backgroundColor.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| backgroundColor | string | The labels background color |
Returns the current builder.
backgroundOpacity
backgroundOpacity(backgroundOpacity);
Set the labels styles backgroundOpacity.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| backgroundOpacity | number | The labels background opacity |
Returns the current builder.
cornerRadius
cornerRadius(cornerRadius);
Set the labels styles cornerRadius.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| cornerRadius | number | The labels corner radius |
Returns the current builder.
pointerWidth
pointerWidth(pointerWidth);
Set the labels styles pointerWidth.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| pointerWidth | number | The labels pointer width |
Returns the current builder.
pointerHeight
pointerHeight(pointerHeight);
Set the labels styles pointerHeight.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| pointerHeight | number | The labels pointer height |
Returns the current builder.
pointerDirection
pointerDirection(pointerDirection);
Set the labels styles pointerDirection.
Parameters
| NAME | TYPE | DESCRIPTION |
|---|---|---|
| pointerDirection | "UP" | "DOWN" | "LEFT" | "RIGHT" | The labels pointer direction |
Returns the current builder.
build
build();
Returns the final Label item.