Skip to main content

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

NAMETYPEDESCRIPTION
textTextContentThe content of the text

Returns the current builder.


width

width(width);

Set the texts width.

Parameters

NAMETYPEDESCRIPTION
widthTextSizeThe text width

Returns the current builder.


height

height(height);

Set the texts height.

Parameters

NAMETYPEDESCRIPTION
heightTextSizeThe text height

Returns the current builder.


plainText

plainText(plainText);

Set the texts plainText.

Parameters

NAMETYPEDESCRIPTION
plainTextstringThe plain text

Returns the current builder.


padding

padding(padding);

Set the text styles padding.

Parameters

NAMETYPEDESCRIPTION
paddingnumberThe text padding

Returns the current builder.


fontFamily

fontFamily(fontFamily);

Set the text styles fontFamily.

Parameters

NAMETYPEDESCRIPTION
fontFamilystringThe text font family

Returns the current builder.


fontSize

fontSize(fontSize);

Set the text styles fontSize.

Parameters

NAMETYPEDESCRIPTION
fontSizenumberThe text font size

Returns the current builder.


fontWeight

fontWeight(fontWeight);

Set the text styles fontWeight.

Parameters

NAMETYPEDESCRIPTION
fontWeightnumberThe text font weight

Returns the current builder.


textAlign

textAlign(textAlign);

Set the text styles textAlign.

Parameters

NAMETYPEDESCRIPTION
textAlign"LEFT" | "CENTER" | "RIGHT"The text horizontal alignment

Returns the current builder.


textAlignVertical

textAlignVertical(textAlignVertical);

Set the text styles textAlignVertical.

Parameters

NAMETYPEDESCRIPTION
textAlignVertical"BOTTOM" | "MIDDLE" | "TOP"The text vertical alignment

Returns the current builder.


fillColor

fillColor(fillColor);

Set the text styles fillColor.

Parameters

NAMETYPEDESCRIPTION
fillColorstringThe texts fill color

Returns the current builder.


fillOpacity

fillOpacity(fillOpacity);

Set the text styles fillOpacity.

Parameters

NAMETYPEDESCRIPTION
fillOpacitynumberThe texts fill opacity

Returns the current builder.


strokeColor

strokeColor(strokeColor);

Set the text styles strokeColor.

Parameters

NAMETYPEDESCRIPTION
strokeColorstringThe texts stroke color

Returns the current builder.


strokeOpacity

strokeOpacity(strokeOpacity);

Set the text styles strokeOpacity.

Parameters

NAMETYPEDESCRIPTION
strokeOpacitynumberThe texts stroke opacity

Returns the current builder.


strokeWidth

strokeWidth(strokeWidth);

Set the text styles strokeWidth.

Parameters

NAMETYPEDESCRIPTION
strokeWidthnumberThe texts stroke width

Returns the current builder.


lineHeight

lineHeight(lineHeight);

Set the text styles lineHeight.

Parameters

NAMETYPEDESCRIPTION
lineHeightnumberThe texts line height

Returns the current builder.


style

style(style);

Set the labels style.

Parameters

NAMETYPEDESCRIPTION
styleLabelStyleThe labels style

Returns the current builder.


backgroundColor

backgroundColor(backgroundColor);

Set the labels styles backgroundColor.

Parameters

NAMETYPEDESCRIPTION
backgroundColorstringThe labels background color

Returns the current builder.


backgroundOpacity

backgroundOpacity(backgroundOpacity);

Set the labels styles backgroundOpacity.

Parameters

NAMETYPEDESCRIPTION
backgroundOpacitynumberThe labels background opacity

Returns the current builder.


cornerRadius

cornerRadius(cornerRadius);

Set the labels styles cornerRadius.

Parameters

NAMETYPEDESCRIPTION
cornerRadiusnumberThe labels corner radius

Returns the current builder.


pointerWidth

pointerWidth(pointerWidth);

Set the labels styles pointerWidth.

Parameters

NAMETYPEDESCRIPTION
pointerWidthnumberThe labels pointer width

Returns the current builder.


pointerHeight

pointerHeight(pointerHeight);

Set the labels styles pointerHeight.

Parameters

NAMETYPEDESCRIPTION
pointerHeightnumberThe labels pointer height

Returns the current builder.


pointerDirection

pointerDirection(pointerDirection);

Set the labels styles pointerDirection.

Parameters

NAMETYPEDESCRIPTION
pointerDirection"UP" | "DOWN" | "LEFT" | "RIGHT"The labels pointer direction

Returns the current builder.


build

build();

Returns the final Label item.