Expand description
Material 3 Expressive controls and theme for GPUI applications.
Initialize MaterialRoot and call init_components before opening windows. Compose controls with GPUI elements and keep controlled selection and command outcomes in the application. Sliders use a retained SliderState entity.
Re-exports§
pub use gpui_material_foundation as foundation;pub use gpui_material_theme as theme;
Structs§
- Adaptive
Navigation - Material 3 navigation suite. Compact and medium widths use a short bar; expanded widths use a collapsed rail. Create the items with the same collection and destination IDs on every render.
- AppBar
- Top app bar with caller-owned navigation, actions, and optional search. Pass the content scroll handle to collapse flexible variants on scroll.
- Badge
- An anchored badge. Pass its accessible name to the host control so the host announces the count once and keeps a single focus stop.
- Button
- A labeled Material action. Activation uses Base’s pointer, keyboard and accessibility behavior and invokes the application callback once.
- Card
- A static surface or a keyboard-operable action with independent child controls.
- Checkbox
- Controlled Material checkbox. Mixed activation requests Checked.
- Chip
- A Material chip. Filter and Input chips request controlled selection changes. Filter and Input chips can expose a separate removal action with its own focus.
- Circular
Progress - Circular progress. Supply a fraction from 0 to 1, or omit it for indeterminate progress.
- Dialog
- A Material modal with a title and optional description, body, and actions.
- Dialog
State - Retains one modal’s focus scope and the focus to restore on close.
- Divider
- Decorative Material divider, with logical start and end insets.
- Dropdown
Option - A selectable dropdown value. IDs remain stable when options are reordered.
- Exposed
Dropdown - A Material field and anchored list in editable and selection-only modes. Typing filters the list, while only selecting an option calls the owner.
- Exposed
Dropdown State - Keeps the editable query and pending keyboard choice across renders.
- Extended
Fab - An elevated icon and label action. Expansion is controlled by the caller. Both presentations share the same focus handle, action and accessible name.
- Fab
- An elevated icon action with a required accessibility name. Mount it beside the scroll viewport to keep its position fixed while content scrolls.
- Feed
- An ordered, vertically scrolling feed. Supply the same scroll handle when the number of columns changes. Cards are placed in reading order.
- Floating
Action - Places a FAB inside the current window viewport at logical bottom-end. Mount this element beside the scroll owner so it stays visible while scrolling.
- Icon
- A decorative icon by default;
.labelexposes an independently meaningful image. Named symbols inherit text size and foreground, including disabled colors, from their control’s icon slot. Outside a slot, use.size(px(24.))for a 24dp icon. Custom SVG paths use the application’s AssetSource. Mirroring is opt-in. - Icon
Button - An icon-only action with a required accessibility name.
- Icon
Toggle Button - An icon-only controlled toggle. The selected icon and native toggle state both reflect the caller’s value.
- Linear
Progress - Horizontal progress. Supply a fraction from 0 to 1, or omit it for indeterminate progress.
- List
- A list of identified rows. Applications can supply a visible window of rows from their own virtualized collection.
- List
Detail - Shows a list or detail at compact and medium widths, and both at expanded widths. The owner retains pane entities and scroll handles, selects the narrow pane and supplies the back command.
- List
Item - A row with a stable domain ID, text and optional leading/trailing slots.
- Loading
Indicator - Status for an operation with unknown duration. The parent removes the indicator when the operation settles or sets it inactive to retain its space.
- Material
Root - Initializes Material and Base before the application opens its first window.
- Material
Theme - Application-owned configuration consumed by the Material rendering layer.
- Menu
- Positions a Material menu against a caller-owned, keyboard-focusable trigger. Pointer and keyboard activation use the same Base popover focus lifecycle.
- Menu
Item - An item in a Material menu. Callers retain command and selection state.
- Navigation
Bar - Material Expressive short navigation bar.
- Navigation
Item - One destination or tab with an ID unique within its collection.
- Navigation
Items - Controlled destinations. Use the same collection ID across adaptive presentations to preserve focus on the destination that currently owns it.
- Navigation
Rail - Material wide navigation rail. An optional modal uses the window’s existing sheet focus scope and restores the trigger on dismissal.
- Radio
- A radio option. A group owns the tab stop and the caller owns selection.
- Radio
Group - A controlled single-selection group with one Tab stop and directional navigation.
- Scaffold
- Arranges the top app bar, leading rail, content and bottom bar. The floating action and snackbar are anchored within the content region above bottom navigation. Give the scaffold a bounded size and give its content a scroll viewport if needed.
- Sheet
- A docked or modal Material sheet. Standard sheets take part in parent layout. The caller owns the bottom sheet’s expanded value and handles changes.
- Slider
- An Expressive slider. Base owns the value and step grid. The caller retains the state entity and observes its SliderEvent notifications.
- Slider
State - State of the
Slider. - Snackbar
- A message for a window’s snackbar queue. The default timeout is four seconds.
- Snackbar
Host - One FIFO message queue per host. Mount the entity in the window layout. A new message leaves keyboard focus wherever it is.
- Supporting
Pane - A main workspace with an optional trailing support pane. In single-pane mode the caller can show the supporting pane as a full-width view.
- Surface
- A Material surface with semantic foreground, tonal elevation, and optional shadow.
- Switch
- Material switch. The caller owns the checked state and optional thumb icons.
- Tabs
- A fixed Material tab row by default. Enable scrolling for long tab lists.
- Text
- Single-line Material text. Measurement and painting share Foundation’s shaped glyphs, including font fallback and letter spacing.
- Text
Field - A Material presentation for a caller-owned Base text editing entity.
- Toggle
Button - A controlled labeled toggle. The caller re-renders with the selected value after accepting a requested change.
- Tooltip
- A delayed plain or interactive rich Material tooltip anchored to a trigger.
Enums§
- AppBar
Variant - Button
Shape - Button
Variant - Card
Variant - Checkbox
State - The semantic value exposed by an unstyled
Checkbox. - Chip
Variant - Control
Size - Material Expressive sizes, from extra small to extra large.
- Dialog
Variant - Window-relative presentation for a Material dialog.
- FabColor
- FabSize
- Expressive FAB sizes. Small is the 56 dp FAB and Small Extended FAB.
- Icon
Button Variant - Icon
Button Width - Icon
Name - Bundled official Material Symbols Outlined, weight 400, grade 0, optical size 24. Both fill variants are embedded unchanged, without an application AssetSource.
- List
Detail Pane - List
Variant - Navigation
BarLayout - Progress
Shape - Straight or Expressive wavy progress track.
- Rail
Mode - Sheet
Edge - Sheet
Mode - Slider
Event - Events emitted by the
SliderState. - Slider
Kind - Slider
Scale - The scale mode of the slider.
- Slider
Value - The value of the slider, can be a single value or a range of values.
- TabVariant
- Text
Field Event - An event emitted by an input.
- Text
Field Variant - Material text field container treatment. The default is Filled.
- Toggle
Button Variant
Functions§
- init_
components - Installs component keybindings after initializing the Material root.
- material_
theme - Returns the shared Material theme installed by
MaterialRoot::init. - set_
material_ theme - Commits the application theme and projects semantic defaults into Base before refreshing windows. A window or subtree can pass an explicit theme to its elements.
Type Aliases§
- Text
Area State - State for editing ordinary multi-line text.
- Text
Field State - State for a single-line text input.