#[repr(C)]pub enum Widget {
Show 34 variants
Text {
content: String,
style: TextStyle,
},
Image {
source: String,
shape: ImageShape,
ratio: ImageRatio,
},
Badge {
label: String,
tone: Tone,
},
Avatar {
source: String,
status: Option<Tone>,
},
PdfView {
url: String,
},
Video {
url: String,
id: String,
playing: bool,
seek_to_ms: i64,
controls: bool,
looping: bool,
muted: bool,
on_ended: Option<ActionToken>,
},
Rating {
value: u32,
max: u8,
on_rate: Option<Vec<ActionToken>>,
},
ColorDot {
color: ProjectColor,
},
Divider,
Progress {
value: Option<f32>,
},
Skeleton,
Chart {
series: Vec<ChartSeries>,
labels: Vec<String>,
style: ChartStyle,
axis: bool,
legend: bool,
},
RegionChart {
regions: Vec<ChartRegion>,
ticks: Vec<ChartTick>,
x_max: f32,
y_max: f32,
ref_lines: Vec<ChartRefLine>,
bracket: Option<ChartBracket>,
legend: Vec<ChartLegendItem>,
},
Calendar {
year: u32,
month: u8,
first_weekday: u8,
selected: Option<u8>,
on_day: Vec<ActionToken>,
},
SwipeAction {
child: Box<Widget>,
actions: Vec<SwipeButton>,
},
LazyList {
children: Vec<Widget>,
on_load_more: Option<ActionToken>,
loading: bool,
has_more: bool,
on_refresh: Option<ActionToken>,
refreshing: bool,
},
Spacer {
size: Spacing,
},
Row {
children: Vec<Widget>,
},
Column {
children: Vec<Widget>,
},
Card {
child: Box<Widget>,
style: CardStyle,
on_press: Option<ActionToken>,
},
Box {
children: Vec<Widget>,
align: BoxAlign,
scrim: bool,
},
Grid {
children: Vec<Widget>,
},
Scroller {
children: Vec<Widget>,
},
Button {
label: String,
style: ButtonStyle,
on_press: ActionToken,
},
IconButton {
icon: Icon,
on_press: ActionToken,
},
Chip {
label: String,
selected: bool,
on_press: ActionToken,
},
TextField {
id: String,
placeholder: String,
value: String,
kind: FieldKind,
error: Option<String>,
},
SearchField {
id: String,
placeholder: String,
value: String,
},
Segmented {
segments: Vec<Segment>,
},
Toggle {
id: String,
label: String,
value: bool,
},
Checkbox {
id: String,
label: String,
value: bool,
},
Slider {
id: String,
value: i32,
max: i32,
},
Stepper {
value: i32,
on_decrement: ActionToken,
on_increment: ActionToken,
},
Scaffold {
title: String,
body: Box<Widget>,
tabs: Vec<Tab>,
back: Option<ActionToken>,
dark_mode: bool,
theme: Option<Theme>,
fab: Option<Fab>,
sheet: Option<Sheet>,
on_refresh: Option<ActionToken>,
refreshing: bool,
route: String,
depth: u32,
},
}Expand description
The app-agnostic widget tree the shell renders. Fixed across all apps.
Variants§
Text
Image
Badge
Avatar
A circular avatar image with an optional colored status dot.
PdfView
An in-app PDF viewer showing the document at url (a remote https URL or a local
file URI). Each shell uses its native renderer — PDFKit on iOS, a paged PdfRenderer
on Android, an <iframe> on web — so the app only supplies the URL (e.g. a
backend-generated report). Fills its width; give it room (place in a sized container).
Video
An in-app native video player for the stream/file at url (MP4 everywhere; HLS .m3u8 on
iOS/Android natively + Safari on web; or a local file URI). Native player per shell — AVPlayer
(iOS), Media3/ExoPlayer (Android), a <video> element (web). Controllable: playing drives
play/pause (app-owned, like a Toggle); set seek_to_ms to jump (the shell seeks when the value
CHANGES; -1 = no seek). The shell reports the current position ~once/second via
Action::Input { id, value: Int(position_ms) } (handle it in [MobilerApp::input]), and fires
on_ended when the clip finishes. controls shows the native transport bar; looping restarts
on end; muted starts muted (needed for reliable autoplay). Fills its width; give it room.
Fields
on_ended: Option<ActionToken>Rating
A star rating. value is in tenths (e.g. 48 = 4.8 of max stars). When on_rate
is set (one token per star), the stars are tappable — star i fires on_rate[i].
ColorDot
Small non-interactive colored dot — a project/identity hint.
Fields
color: ProjectColorDivider
Progress
Progress indicator: value 0.0–1.0 for a determinate bar, None for an indeterminate spinner.
Skeleton
Shimmer placeholder shown while content loads.
Chart
A data chart drawing one or more named series in the given style (see ChartStyle).
labels (optional) annotate the x-axis for cartesian styles. axis shows y gridlines +
tick values (cartesian only); legend shows a series swatch+name row. Non-interactive.
RegionChart
A variable-width stacked-region (“Marimekko” / coverage-gap) chart: regions are arbitrary
colored rectangles in the [0, x_max] × [0, y_max] plane (each with an in-cell label),
ticks annotate the irregular x-axis, ref_lines are horizontal target/max lines with
right-edge chips, bracket is an optional right-side range annotation, and legend names
the colors. The app supplies all geometry; shells map domain→pixels. Non-interactive.
Fields
regions: Vec<ChartRegion>ref_lines: Vec<ChartRefLine>bracket: Option<ChartBracket>legend: Vec<ChartLegendItem>Calendar
An inline month calendar. first_weekday is the weekday of day 1 (0=Sun..6=Sat) so the
shells render leading blanks without date math; on_day[d-1] fires when day d is tapped
(length = days in the month). selected highlights a day.
SwipeAction
A list row that reveals trailing actions on horizontal swipe (each tappable). On web the
actions render inline as a trailing button row (no gesture).
LazyList
A scrollable list for long/paged feeds, with shell-detected events at both ends: the bottom
on_load_more fires when the user scrolls near the end (infinite scroll), the top
on_refresh fires on pull-to-refresh. loading/refreshing/has_more are app-owned: set
loading while a page loads (shell shows a spinner, stops firing), has_more=false when
exhausted, and refreshing while a pull-refresh runs. The app appends to children on each
load-more. on_refresh is set via with_refresh.
Spacer
Row
Column
Card
Card; tappable when on_press is set.
Box
Z-stack: children layered back-to-front, positioned by align. With
scrim, the first child is a background image, darkened for legibility,
and the rest render on top in light content.
Grid
Fixed 2-column grid; children flow left-to-right, top-to-bottom.
Scroller
Horizontally scrolling row of children (a carousel / chip rail).
Button
IconButton
Chip
TextField
A text input. kind selects keyboard / secure entry / multiline
(see FieldKind); error, when Some, shows an inline validation
message below the field and marks it invalid. Emits Input { id, Text }.
SearchField
A search input (leading magnifier, pill shape); emits Input { id, Text } like TextField.
Segmented
A single-choice segmented control — exclusive options in a pill (e.g. Men/Women/Kids).
Toggle
Checkbox
Slider
Continuous 0..=max slider; emits Input { id, Int }.
Stepper
Numeric stepper with −/+ controls carrying their own events.
Scaffold
App shell: a top bar (title + optional back), a scrollable body,
and bottom-nav tabs. dark_mode is theme-as-data — the shell themes
the whole app from it.
route + depth drive navigation: the shell animates the body when
route (the current screen’s identity) changes — slide for push/pop
(direction from whether depth grew or shrank), crossfade for a lateral
move at the same depth — and wires the system back button to back.
Fields
back: Option<ActionToken>theme: Option<Theme>App branding (brand color, corner, density, font). None = framework
defaults (no visual change) — theme-as-data, the visual twin of dark_mode.
on_refresh: Option<ActionToken>Pull-to-refresh: when set, the body is pull-refreshable and fires this event on pull.
The app owns refreshing — set it true when the pull fires, clear it when the async
reload completes (the shell shows a spinner while it’s true).