Text

UI Element - Text

class UI.Text

All attributes are read/write: You can access (read) and modify (set) any attribute at any time, and the changes will immediately reflect in the UI.

# Appending text to a card
text = card.create_ui_element(UI.Text,
    content="Hello, World!",
    size="sm",
    weight="bold",
    color="#FFFFFF",
    align="left"
)

# Appending text to a card, leaving the default settings
text = card.create_ui_element(UI.Text)

# Setting attributes
text.content = "Hello, World"
Attribute
Value

content

any string

Note: use \n to create a new line.

size

"tiny"

"sm"

"base"

"lg"

"xl"

"2xl" Default: "base"

weight

"thin"

"light"

"normal"

"medium"

"bold"

"extrabold" "black" Default: "normal"

color

Any CSS valid color value.

See: CSS Color Values

Examples: "#FFFFFF" "black" "rgb(255, 0, 0)" "hsla(0, 100%, 50%, 0.5)"

Default: "#FFFFFF"

align

"left"

"center"

"right" Default: "left"

margin

See Margin. Default: "m-0"

visible

See Visible. Default: True

Last updated

Was this helpful?