Skip to main content

Crate gpui_material

Crate gpui_material 

Source
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§

AdaptiveNavigation
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.
CircularProgress
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.
DialogState
Retains one modal’s focus scope and the focus to restore on close.
Divider
Decorative Material divider, with logical start and end insets.
DropdownOption
A selectable dropdown value. IDs remain stable when options are reordered.
ExposedDropdown
A Material field and anchored list in editable and selection-only modes. Typing filters the list, while only selecting an option calls the owner.
ExposedDropdownState
Keeps the editable query and pending keyboard choice across renders.
ExtendedFab
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.
FloatingAction
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; .label exposes 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.
IconButton
An icon-only action with a required accessibility name.
IconToggleButton
An icon-only controlled toggle. The selected icon and native toggle state both reflect the caller’s value.
LinearProgress
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.
ListDetail
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.
ListItem
A row with a stable domain ID, text and optional leading/trailing slots.
LoadingIndicator
Status for an operation with unknown duration. The parent removes the indicator when the operation settles or sets it inactive to retain its space.
MaterialRoot
Initializes Material and Base before the application opens its first window.
MaterialTheme
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.
MenuItem
An item in a Material menu. Callers retain command and selection state.
NavigationBar
Material Expressive short navigation bar.
NavigationItem
One destination or tab with an ID unique within its collection.
NavigationItems
Controlled destinations. Use the same collection ID across adaptive presentations to preserve focus on the destination that currently owns it.
NavigationRail
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.
RadioGroup
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.
SliderState
State of the Slider.
Snackbar
A message for a window’s snackbar queue. The default timeout is four seconds.
SnackbarHost
One FIFO message queue per host. Mount the entity in the window layout. A new message leaves keyboard focus wherever it is.
SupportingPane
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.
TextField
A Material presentation for a caller-owned Base text editing entity.
ToggleButton
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§

AppBarVariant
ButtonShape
ButtonVariant
CardVariant
CheckboxState
The semantic value exposed by an unstyled Checkbox.
ChipVariant
ControlSize
Material Expressive sizes, from extra small to extra large.
DialogVariant
Window-relative presentation for a Material dialog.
FabColor
FabSize
Expressive FAB sizes. Small is the 56 dp FAB and Small Extended FAB.
IconButtonVariant
IconButtonWidth
IconName
Bundled official Material Symbols Outlined, weight 400, grade 0, optical size 24. Both fill variants are embedded unchanged, without an application AssetSource.
ListDetailPane
ListVariant
NavigationBarLayout
ProgressShape
Straight or Expressive wavy progress track.
RailMode
SheetEdge
SheetMode
SliderEvent
Events emitted by the SliderState.
SliderKind
SliderScale
The scale mode of the slider.
SliderValue
The value of the slider, can be a single value or a range of values.
TabVariant
TextFieldEvent
An event emitted by an input.
TextFieldVariant
Material text field container treatment. The default is Filled.
ToggleButtonVariant

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§

TextAreaState
State for editing ordinary multi-line text.
TextFieldState
State for a single-line text input.