Skip to main content

Module form_layout

Module form_layout 

Source
Expand description

FormLayout — a two-column settings or preferences form layout.

Children are added as label/field pairs via FormLayout::line (inline widgets) or FormLayout::line_ids (pre-registered IDs). Full-width rows that span both columns — section headers, Dividers, or banners — are added via FormLayout::full_width / FormLayout::full_width_id. The label column auto-sizes to the widest label across all pairs so all field inputs are left-aligned. RTL layouts are handled automatically: the label column migrates to the trailing side and the field column moves to the leading side. Dormant rows are excluded from both measurement and placement.

When an accessible name is provided via FormLayout::label, the widget emits Role::Form so screen-reader users can navigate directly to the form. Without a name it demotes to a presentational GenericContainer.

let _form = FormLayout::new()
    .label_gap(8.0)
    .row_spacing(6.0)
    .line(TextWidget::new(lit!("Name:")),  RectWidget::new())
    .line(TextWidget::new(lit!("Email:")), RectWidget::new());

Structs§

FormLayout
A two-column form layout with auto-sized label column.