Widgets

Text

Text

Display labels, headings, counters, and inline status values.

Example

text(value: "Dashboard", style: { size: 28, weight: "w700" })

Common properties

  • positional value: text("Hello")
  • keyword value: text(value: "Hello")
  • style
  • selectable

Usage

title = text(value: "Ruflet", style: { size: 28, weight: "w700" })
subtitle = text("Ruby UI for every screen")

Notes

Common style keys used in Ruflet examples:

  • size
  • weight
  • color

Complete API

Helpers

  • text(value = ..., **props)

Accepted properties

  • alignment — Alignment of the content within the control.
  • bgcolor — Background color.
  • color — Foreground color.
  • data — Arbitrary value you can attach to the control and read back in handlers.
  • ellipsis — Sets the ellipsis property.
  • enable_interactive_selection — Sets the enable interactive selection property.
  • font_family — Sets the font family property.
  • font_family_fallback — Sets the font family fallback property.
  • italic — Sets the italic property.
  • key — Stable identity used to preserve state across rebuilds.
  • max_lines — Sets the max lines property.
  • max_width — Max width.
  • no_wrap — Sets the no wrap property.
  • overflow — Sets the overflow property.
  • rotate — Rotation applied to the control.
  • selectable — Sets the selectable property.
  • selection_cursor_color — Selection cursor color.
  • selection_cursor_height — Selection cursor height.
  • selection_cursor_width — Selection cursor width.
  • semantics_label — Sets the semantics label property.
  • show_selection_cursor — Sets the show selection cursor property.
  • size — Sets the size property.
  • spans — Sets the spans property.
  • style — Style overrides for the control.
  • text_align — Sets the text align property.
  • theme_style — Theme style.
  • value — The control's current value.
  • weight — Sets the weight property.
  • x — Sets the x property.
  • y — Sets the y property.

Events

  • on_selection_change — Fired when the selection range changes.
  • on_tap — Fired on a tap.

Wire reference

  • Family: shared
  • Widget type: text