core::text
Structs
Text
Renders and styles text through the target's native text system.
A constrained width with an omitted height allows native measurement to determine the height of wrapped content. Selection, editing, font loading, and accessibility behavior depend on the target's native implementation; test the intended interaction on each shipping target.
Properties
editable
Type: Property<bool>
Whether the text can be edited by the user.
selectable
Type: Property<bool>
Requests selectable text. On the current iOS/iPadOS path, non-editable
text uses the interactive selection view only when clip is enabled.
clip
Type: Property<bool>
Whether text overflow is clipped to the node bounds.
text
Type: Property<String>
Text content to display.
style
Text styling.
markdown
Type: Property<bool>
Whether text should be interpreted as Markdown.
wrap
Type: Property<bool>
Whether long text lines should wrap inside the node bounds.
TextStyle
Struct describing platform-agnostic text display properties.
Properties
font
Font family/source/style/weight configuration.
font_size
Font size, in pixels.
fill
Text color. Native text patches reduce gradient fills to their first stop's color; use a solid fill for predictable text color.
underline
Type: Property<bool>
Whether text should be underlined.
align_multiline
Type: Property<TextAlignHorizontal>
Alignment for multiline text layout.
align_vertical
Type: Property<TextAlignVertical>
Vertical text alignment within its bounds.
align_horizontal
Type: Property<TextAlignHorizontal>
Horizontal text alignment within its bounds.
Enums
Font
Describes a font available to native text renderers.
Pax templates may use either the explicit [Font::Web] constructor or a
contextual shorthand. A string names a locally available family with an
empty source URL and normal style and weight:
font: "Times New Roman"
Named object fields describe font sources and optional modifiers. Omitted
fields retain their defaults. Supplying family without url selects a
locally available family, matching the string shorthand. weight accepts
either [FontWeight] or its CSS numeric equivalent from 100 through
900:
font: {
family: "Inter"
url: "https://example.com/Inter-Italic.ttf"
style: FontStyle::Italic
weight: 700
}
Nonempty URLs identify font files, except that Google Fonts URLs containing
fonts.googleapis.com/css receive special stylesheet handling. Relative
asset URLs work on web; the native Web-font loader does not resolve them
into application bundle resources. Native targets also require the actual
font family name, rather than a browser-only alias.
Font shorthand has no positional ("magic index") fields: named keys are
canonical, and positional list/tuple forms are not accepted. Use the
explicit [Font::Web] constructor as verbose longhand when needed.
Variants
Web(String, String, FontStyle, FontWeight)
Font described by family name, source URL, style, and weight.
FontStyle
Describes available font styles.
Variants
Normal
Italic
Oblique
FontWeight
Describes available font weights.
Variants
Thin
ExtraLight
Light
Normal
Medium
SemiBold
Bold
ExtraBold
Black
Implementations
decrease
pub fn decrease(weight: FontWeight) -> FontWeight
Returns the next lighter named font weight.
increase
pub fn increase(weight: FontWeight) -> FontWeight
Returns the next heavier named font weight.
TextAlignHorizontal
Describes available horizontal text alignments.
Variants
Left
Center
Right
TextAlignVertical
Describes available vertical text alignments.