pub struct UiBuilder<T> { /* private fields */ }Expand description
The main fluent authoring surface: value.ui().px_2().w_full().into_element(cx).
Implementations§
Source§impl<T> UiBuilder<T>
impl<T> UiBuilder<T>
pub fn new(inner: T) -> Self
pub fn semantics(self, decoration: SemanticsDecoration) -> Self
pub fn test_id(self, test_id: impl Into<Arc<str>>) -> Self
pub fn a11y_role(self, role: SemanticsRole) -> Self
pub fn role(self, role: SemanticsRole) -> Self
pub fn a11y_label(self, label: impl Into<Arc<str>>) -> Self
pub fn key_context(self, key_context: impl Into<Arc<str>>) -> Self
pub fn style(self, style: ChromeRefinement) -> Selfwhere
T: UiSupportsChrome,
pub fn layout(self, layout: LayoutRefinement) -> Selfwhere
T: UiSupportsLayout,
pub fn style_with(
self,
f: impl FnOnce(ChromeRefinement) -> ChromeRefinement,
) -> Selfwhere
T: UiSupportsChrome,
pub fn layout_with(
self,
f: impl FnOnce(LayoutRefinement) -> LayoutRefinement,
) -> Selfwhere
T: UiSupportsLayout,
Source§impl UiBuilder<TextBox>
impl UiBuilder<TextBox>
Sourcepub fn selectable(self, selectable: bool) -> Self
pub fn selectable(self, selectable: bool) -> Self
Enables or disables drag-to-select + edit.copy for this text element.
Notes:
- Keep this off by default for most UI labels to avoid gesture conflicts with pressable rows/buttons. Prefer a dedicated copy button in interactive surfaces.
Sourcepub fn selectable_on(self) -> Self
pub fn selectable_on(self) -> Self
Convenience helper for selectable(true).
Sourcepub fn selectable_off(self) -> Self
pub fn selectable_off(self) -> Self
Convenience helper for selectable(false).
pub fn text_xs(self) -> Self
pub fn text_sm(self) -> Self
pub fn text_base(self) -> Self
pub fn text_prose(self) -> Self
pub fn font_weight(self, weight: FontWeight) -> Self
pub fn font(self, font: FontId) -> Self
pub fn font_feature(self, tag: impl Into<String>, value: u32) -> Self
pub fn font_axis(self, tag: impl Into<String>, value: f32) -> Self
Sourcepub fn tabular_nums(self) -> Self
pub fn tabular_nums(self) -> Self
Enables OpenType tabular numbers (font-variant-numeric: tabular-nums).
Sourcepub fn proportional_nums(self) -> Self
pub fn proportional_nums(self) -> Self
Enables OpenType proportional numbers (font-variant-numeric: proportional-nums).
Sourcepub fn lining_nums(self) -> Self
pub fn lining_nums(self) -> Self
Enables OpenType lining numbers (font-variant-numeric: lining-nums).
Sourcepub fn oldstyle_nums(self) -> Self
pub fn oldstyle_nums(self) -> Self
Enables OpenType oldstyle numbers (font-variant-numeric: oldstyle-nums).
Sourcepub fn slashed_zero(self) -> Self
pub fn slashed_zero(self) -> Self
Enables OpenType slashed zero (font-variant-numeric: slashed-zero).
Sourcepub fn diagonal_fractions(self) -> Self
pub fn diagonal_fractions(self) -> Self
Enables OpenType diagonal fractions (font-variant-numeric: diagonal-fractions).
Sourcepub fn stacked_fractions(self) -> Self
pub fn stacked_fractions(self) -> Self
Enables OpenType stacked fractions (font-variant-numeric: stacked-fractions).
pub fn font_ui(self) -> Self
pub fn font_monospace(self) -> Self
pub fn font_normal(self) -> Self
pub fn font_medium(self) -> Self
pub fn font_semibold(self) -> Self
pub fn font_bold(self) -> Self
pub fn text_color(self, color: ColorRef) -> Self
pub fn text_size_px(self, size: Px) -> Self
pub fn line_height_px(self, height: Px) -> Self
pub fn line_height_em(self, line_height_em: f32) -> Self
pub fn line_height_preset(self, preset: TextLineHeightPreset) -> Self
pub fn line_height_policy(self, policy: TextLineHeightPolicy) -> Self
pub fn control(self) -> Self
pub fn content(self) -> Self
Sourcepub fn fixed_line_box_px(self, height: Px) -> Self
pub fn fixed_line_box_px(self, height: Px) -> Self
Configures a fixed line box by setting both line_height_px(height) and h_px(height).
This is a pragmatic escape hatch for fixed-height controls (tabs, pills, buttons) where centering by glyph bounds can read as slightly bottom-heavy. A fixed line box allows the text widget to apply CSS/GPUI-like “half-leading” baseline placement.
pub fn letter_spacing_em(self, letter_spacing_em: f32) -> Self
pub fn wrap(self, wrap: TextWrap) -> Self
pub fn overflow(self, overflow: TextOverflow) -> Self
pub fn ink_overflow(self, ink_overflow: TextInkOverflow) -> Self
pub fn auto_pad_ink_overflow(self) -> Self
pub fn text_align(self, align: TextAlign) -> Self
pub fn nowrap(self) -> Self
pub fn truncate(self) -> Self
Sourcepub fn break_words(self) -> Self
pub fn break_words(self) -> Self
Sets TextWrap::WordBreak and clips overflow.
This matches Tailwind’s break-words intent (prevent horizontal overflow by allowing
breaks inside long tokens such as URLs, paths, and identifiers).
Sourcepub fn text_balance(self) -> Self
pub fn text_balance(self) -> Self
Enables balanced line breaking (Tailwind text-balance).
Sourcepub fn line_box_in_bounds(self) -> Self
pub fn line_box_in_bounds(self) -> Self
Opt into “bounds-as-line-box” baseline placement for fixed-height controls.
This is intended for single-line labels that should look vertically centered inside a container whose height is larger than the natural line height.
Source§impl UiBuilder<RawTextBox>
impl UiBuilder<RawTextBox>
pub fn text_color(self, color: ColorRef) -> Self
pub fn wrap(self, wrap: TextWrap) -> Self
pub fn overflow(self, overflow: TextOverflow) -> Self
pub fn ink_overflow(self, ink_overflow: TextInkOverflow) -> Self
pub fn auto_pad_ink_overflow(self) -> Self
pub fn text_align(self, align: TextAlign) -> Self
pub fn nowrap(self) -> Self
pub fn truncate(self) -> Self
Sourcepub fn break_words(self) -> Self
pub fn break_words(self) -> Self
Sets TextWrap::WordBreak and clips overflow.
This matches Tailwind’s break-words intent (prevent horizontal overflow by allowing
breaks inside long tokens such as URLs, paths, and identifiers).
Sourcepub fn text_balance(self) -> Self
pub fn text_balance(self) -> Self
Enables balanced line breaking (Tailwind text-balance).