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 for the existing Scaffold bar and rail slots.
- Adaptive
Navigation Info - Available scaffold space for an application-supplied navigation policy.
- Adaptive
Navigation State - Retained navigation visibility, independent of the current presentation.
- Adaptive
Pane - A pane slot with stable identity, logical geometry preferences and adaptation.
- Adaptive
Pane Layout - A three-role scaffold with caller-supplied panes, an explicit available viewport, and retained layout, expansion and navigation state.
- Adaptive
Pane State - Retained presentation, expansion and navigation state for a single adaptive layout.
- AppBar
- Top app bar with caller-owned navigation, headings, actions, and optional search.
- AppBar
Colors - Per-instance pigments. Missing fields use the window theme.
- AppBar
Column - Vertical actions with responsive overflow.
- AppBar
Item - One action with an inline representation and an overflow menu representation.
- AppBar
Menu State - Handle to the active strip’s overflow menu, available to its item and trigger builders.
- AppBar
Padding - Logical insets within each app bar row.
- AppBar
Row - Horizontal actions with responsive overflow.
- AppBar
Scroll State - Retained app bar presentation state. Use a distinct entity per app bar.
- Avatar
- A circular or rounded Material avatar displaying initials, an icon, an image, or custom content.
- Avatar
Colors - Optional per-instance pigments for an
Avatar. Omitted fields use the configured color roles. - Avatar
Group - An overlapping horizontal stack of
Avataritems with surface-matched cutout rings and an optional+Noverflow indicator. - Badge
- A standalone or anchored Material badge. For anchored badges, include the badge’s information in the host’s accessible name.
- Banner
- An in-flow, non-blocking Material 3 banner/callout surface.
- Banner
Colors - Optional per-region colors for
Banner. - Bottom
AppBar - Material 3 Bottom App Bar (80 dp default height,
SurfaceContainer,Elevation::Level2). Mounts seamlessly incrate::Scaffold::bottom_baror standalone layouts. - Bottom
AppBar Colors - Optional pigment overrides for
BottomAppBar. Omitted fields use the window theme. - Bottom
AppBar Padding - Logical insets inside a
BottomAppBar. Defaults follow Material 3 (4 dp leading icon inset, 16 dp trailing FAB inset, 12 dp vertical). - Bottom
Sheet State - Retained position, available stops and transitions of a bottom sheet.
- Bottom
Sheet Thresholds - Thresholds for settling a released sheet drag.
- Breadcrumb
Item - One path segment inside
Breadcrumbs. - Breadcrumbs
- Desktop path navigation with RTL mirroring and automatic middle-segment
overflow collapse into an anchored Material
Menu. - Breadcrumbs
Colors - Optional color overrides for
Breadcrumbs. - Button
- A labeled Material action. Activation uses Base’s pointer, keyboard and accessibility behavior and invokes the application callback once.
- Button
Border - A stroke for any button variant. A zero width removes its outline.
- Button
Colors - Per-instance pigments. Each omitted field keeps the variant’s color in that state. Checked colors apply to enabled toggles.
- Button
Elevations - Optional Material elevation levels. Disabled takes precedence, followed by pressed, keyboard focus, hover and rest.
- Button
Padding - Insets around the label or custom content, including leading and trailing icons.
- Button
Shapes - Button corner overrides in logical top-start, top-end, bottom-end, bottom-start order. Unspecified states keep their size and shape presets.
- Card
- A static surface or a keyboard-operable action with independent child controls.
- Card
Border - The card’s stroke. A zero-width border removes the stroke.
- Card
Colors - Per-instance colors. Omitted fields keep their variant and window defaults.
- Card
Elevations - Shadow levels. Each omitted field keeps the variant default for its state.
- Checkbox
- Controlled Material checkbox. Mixed activation requests Checked.
- Checkbox
Colors - Per-instance checkbox colors. Disabled entries take precedence over error entries.
- Checkbox
State Colors - Optional pigments for one checkbox state. Unset fields use the window theme.
- Checkbox
Tile - Settings convenience row wrapping
ListItemwith a synchronized decorativeCheckbox. - 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.
- Chip
Colors - Enabled, selected, and disabled chip pigments. Disabled-selected fields fall back to disabled overrides. Selection applies to Filter and Input chips.
- Chip
Elevations - Optional shadows for each state. Disabled and dragged take precedence over press, keyboard focus, hover, and rest.
- Chip
Group - A controlled collection of Material chips with M3 8 dp spacing, roving
keyboard focus, RTL mirroring, and
Role::ListBoxsemantics. - Chip
Group Item - One chip entry in a
ChipGroupwith a stable caller-owned identifier. - Chip
State Colors - Per-slot pigments for one chip state. Omitted fields retain the defaults.
- Choice
Option - One selectable option in a
ChoiceTileanchored menu. - Choice
Tile - Settings convenience row combining
ListItemwith an anchored MaterialMenuofChoiceOptions. - Circular
Progress - Circular progress. Supply a fraction from 0 to 1, or omit it for indeterminate progress.
- Dialog
- A named Material modal with optional structured slots or caller-defined content.
- Dialog
Action - Activation for a dialog slot, valid while that open dialog owns input.
- Dialog
Colors - Local overrides for a dialog surface and its content slots.
- Dialog
Properties - User dismissal routes for a Material dialog.
- Dialog
State - Retains a dialog’s visibility and focus scope across renders.
- Display
Scrollbar - A read-only scroll position indicator. Mount it after the scroll viewport as a child of the same relative parent and give it a stable ID.
- Display
Scrollbar Fade - Shows the indicator after a scroll offset change, then fades it out.
- Display
Scrollbar Style - Display scrollbar colors and dimensions. Lengths are in logical pixels.
- Divider
- Decorative Material divider, with logical start and end insets.
- Drag
Handle Colors - Fill colors. Omitted values use the corresponding window theme role.
- Drag
Handle Shapes - Corner shapes in logical corner order. Omitted values use Material defaults.
- Drag
Handle Sizes - Visual sizes in logical pixels. Omitted values use Material defaults.
- Drop
Target - Material-styled drag-and-drop container supporting external OS files (
ExternalPaths) and typed in-app GPUI drag payloadsT: 'static. - Drop
Target Colors - Per-instance pigments for idle, valid drag-over, and rejected drag-over states of a
DropTarget. - Dropdown
Option - A selectable dropdown value. IDs remain stable when options are reordered.
- Empty
State - A purely presentational Material 3 Expressive empty-state layout shell.
- 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 action with a label or custom content and an optional icon. All presentations share one action, accessible name, and focus handle.
- Fab
- An elevated icon action with a required accessibility name. Mount it beside the scroll viewport to keep its position fixed while content scrolls.
- FabVisibility
Animation - Appearance and disappearance motion for a controlled FAB.
- 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 and raw SVG data 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.
- Interaction
Source - Observes the presentation state of controls with a shared GPUI entity.
- Interaction
State - A snapshot of interaction state from the caller’s GPUI/Base behavior.
- Interaction
Update - One deferred change from an observed control.
- Label
- An overlay annotation for arbitrary anchor content and its own interaction source.
- 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 Standard or Segmented list row. Values and data changes belong to the caller.
- List
Item Colors - Per-row palette. Omitted colors use the current window’s theme.
- List
Item Elevations - Per-state shadow levels. Rows default to Level0, or Level4 while dragged.
- List
Item Padding - Logical padding in pixels. Using the builder replaces the adaptive defaults.
- List
Item Shapes - Logical shapes for one row. An omitted shape uses the resting or selected shape, including the list’s grouped corners.
- List
Item State Colors - Independent colors inherited by the container and each slot in one state.
- List
Section - Titled list section supporting
ListVariant::Standardand Material 3 ExpressiveListVariant::Segmentedgrouped corner geometry and unified vertical roving focus acrossListItemand settings tiles. - Loading
Indicator - Progress for an operation. Pass a value to select determinate mode, or omit the value for an indeterminate animation.
- Loading
Indicator Shape - An endpoint shape for a loading indicator morph.
- Loading
Indicator Shapes - A prepared sequence of rounded polygons for a loading indicator.
- 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.
- Menu
Item Style - Per-row overrides. Unset shapes and colors follow the menu palette and layout.
- Menu
Surface Style - Per-surface menu styling. Omitted values use defaults appropriate to the surface.
- Navigation
Bar - Material Expressive short navigation bar.
- Navigation
BarColors - Short navigation bar pigments. Item overrides take precedence over
content. - Navigation
Drawer - Full-width Material 3 Navigation Drawer (360 dp default width) with Standard (docked) and Modal (side-sheet) presentations, sections, dividers, and 56 dp pill destination indicators.
- Navigation
Drawer Colors - Per-instance pigment overrides for
NavigationDrawer. Omitted fields use the window theme. - Navigation
Drawer Section - Convenience section grouping an optional heading with a list of
NavigationItems. - Navigation
Item - One destination or tab with an ID unique within its collection.
- Navigation
Item Colors - Optional pigments for an Expressive navigation destination.
- 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. The optional modal uses the side-sheet session.
- Navigation
Rail Colors - Independent local colors and scrim opacity.
- Navigation
Rail Padding - Logical insets in pixels, also used inside a destination’s indicator.
- Navigation
Rail Shapes - Per-mode shape overrides. Omitted values use the default docked or sheet shape.
- Navigation
Rail State - Retained presentation of a docked rail. Modal visibility uses DialogState.
- Pane
Destination - A history entry with an optional stable domain content key.
- Pane
Layout Directive - Available partitions and preferred pane sizes in logical pixels.
- Pane
Layout Value - Presentation of the three roles, independent of their navigation content keys.
- Pane
Margins - Pane margins in logical pixels.
- Pane
Separator - An opt-in resize handle between two adjacent logical roles.
- Polygon
Morph - A reusable morph between two pinned Material polygon roles.
- Progress
Stop - Geometry and appearance passed to a linear determinate stop painter.
- Progress
Stroke - Per-stroke appearance. The default width is 4 dp and the color comes from the window palette’s active or track role.
- Pull
ToRefresh - A vertical viewport with an Expressive refresh indicator and accessible action.
- Pull
ToRefresh Progress - Readback supplied to a caller’s indicator.
- Pull
ToRefresh State - Retained gesture and indicator state. The application owns refreshing.
- Radio
- A radio option. A group owns the tab stop and the caller owns selection.
- Radio
Colors - Radio indicator pigments. Omitted values use the current window theme.
- Radio
Group - A controlled single-selection group with one Tab stop and directional navigation.
- Radio
Tile - Settings convenience row wrapping
ListItemwith a synchronized decorativeRadio. - Rail
Modal Options - Window-local side-sheet policy for the optional modal rail.
- 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.
- Scaffold
Content Layout - Resolved body layout before the content builder applies its padding.
- Scaffold
Insets - Logical edges in pixels. Start and end follow the window direction.
- Scrim
- A backdrop that fills its positioned parent. Add it after background content and before the foreground surface. The caller owns visibility and modal focus.
- Shape
- A prepared shape with a shared mesh for drawing, clipping, hit testing, and effects.
- Shape
Morph - A reusable morph between any two
ShapePolygoncontours. - Shape
Morph Sequence - A reusable multi-step sequence of
ShapeMorphtransitions. - Shape
Polygon - A reusable normalized polygon contour backed by
polymorpher. - 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.
- Sheet
Close - Activation for a close control supplied by the caller.
- Sheet
Colors - Optional local colors for the sheet and its adornments.
- Sheet
Margins - Logical detached margins in pixels. The default is 16 px on each side.
- Skeleton
- An animated Material 3 loading placeholder built on
LoopClockandis_bounds_visible. - Skeleton
Colors - Optional base and highlight pigments for
Skeleton. - Slider
- An Expressive slider. Base owns the value and step grid. The caller retains the state entity and observes its SliderEvent notifications.
- Slider
Colors - Optional slider colors. Unspecified fields use the window theme.
- Slider
Marker - The window position and default paint of a track tick or stop.
- Slider
State - State of the
Slider. - Slider
Thumb Style - Optional dimensions and colors for one handle.
- Slider
Tile - Settings convenience row combining a
ListItemheader, live formatted value display, and an embeddedSliderbound to a caller-ownedSliderState. - Slider
Track Style - Optional track dimensions in logical pixels.
- Snackbar
- A message for a window’s snackbar queue. The default timeout is four seconds.
- Snackbar
Colors - Optional per-region colors. Omitted fields use the window’s inverse palette.
- Snackbar
Host - One FIFO message queue per host. Mount the entity in the window layout. A new message leaves keyboard focus wherever it is.
- Snackbar
Id - An entry in one snackbar host’s queue.
- Snackbar
Parts - Host-owned status and activation elements for a custom layout.
- Step
Item - One step entry in a
Stepper. - Stepper
- Horizontal or vertical Material 3 multi-step indicator and navigator.
- Stepper
Colors - Per-instance pigment overrides for
Stepper. Omitted fields use the window theme. - 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 passive Material background or an interactive surface with arbitrary children.
- Surface
Border - An outline in logical pixels, drawn around the surface’s shape.
- Surface
Feedback - Customizes the Material feedback painted by one interactive surface.
- Swipe
ToDismiss - A foreground and background with logical horizontal swipe gestures. The caller owns the content, action commands, and resulting data changes.
- Swipe
ToDismiss State - Retained swipe state. Give each mounted swipe container its own entity.
- Switch
- Material switch. The caller owns the checked state and optional thumb content.
- Switch
Colors - Per-instance colors for enabled and disabled switches in either checked state.
- Switch
State Colors - Optional pigments for one switch state. Omitted fields use the window theme.
- Switch
Tile - Settings convenience row wrapping
ListItemwith a synchronized decorativeSwitch. - TabIndicator
Layout - Geometry and tint supplied to a decorative custom indicator.
- TabIndicator
Style - Overrides for the indicator that tracks the selected tab.
- Tabs
- A fixed Material tab row by default. Enable scrolling for long tab lists.
- Tabs
Colors - Optional tab row pigments. Per-tab overrides take precedence over
content. - 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.
- Text
Field Color Overrides - Optional colors for a single text field state. An unset role uses the window theme.
- Text
Field Colors - Per-instance colors. Disabled takes precedence over invalid, then focused.
- Text
Field Layout - Geometry reported after the retained Base editor lays out the field.
- Theme
Scope - Applies a Material theme or direction to a child and its Material overlays. The element participates in layout using its child’s layout directly.
- Toggle
Button - A controlled labeled toggle. The caller re-renders with the selected value after accepting a requested change.
- Tooltip
- A transient plain or rich Material tooltip, or a persistent rich tooltip with caller-owned visibility.
- Tooltip
Caret - Tooltip caret geometry. The default triangle is 16 px wide and 8 px deep.
- Tooltip
Colors - Window-theme color overrides for a tooltip’s individual slots.
- Tooltip
Positioner - An unstyled element that positions its children as an anchored popup.
- Tooltip
State - Visibility retained by the owner of a persistent rich tooltip.
- Vertical
Drag Handle - A vertical Material handle for a horizontally adjustable boundary. The owner provides the layout and decides which requested widths to apply.
Enums§
- Adaptive
Navigation Type - Current Material 3 Expressive navigation presentations.
- Adaptive
Navigation Visibility - AppBar
Alignment - Logical alignment for a title or subtitle.
- AppBar
Scroll Behavior - How changes in the linked content offset affect the app bar’s height.
- AppBar
Variant - Avatar
Shape - Outer clipping shape for an
Avatar. - Avatar
Size - Material avatar diameter presets and custom logical-pixel sizing.
- Bottom
Sheet Value - Settled values for a retained bottom sheet.
- Button
Shape - Button
Variant - Card
Variant - Checkbox
State - The semantic value exposed by an unstyled
Checkbox. - Chip
Group Selection - Controlled selection policy for
ChipGroup. - Chip
Variant - Control
Size - Material Expressive sizes, from extra small to extra large.
- Dialog
Close Reason - An accepted transition from an open to a closed Material dialog.
- Dialog
Variant - Window-relative presentation for a Material dialog.
- Dropdown
Anchor - Focus and activation behavior for the primary dropdown anchor.
- FabAlignment
- Logical pivot for the FAB’s visibility transition.
- 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
Item Alignment - Alignment of the slots within one row.
- List
Section Item - Any list row or settings tile that can participate in a
ListSection. - List
Variant - Material
Shape - Named Material 3 Expressive shapes matching pinned Compose
MaterialShapes. - Menu
Color - Semantic color presets for Material vertical menus.
- Navigation
BarArrangement - Distribution of the navigation items along the width of the bar.
- Navigation
BarLayout - Navigation
Drawer Entry - Ordered entry inside a
NavigationDrawerdestination list. - Navigation
Drawer Mode - Presentation mode for a standalone
NavigationDrawer. - Navigation
Item Icon Position - Placement of a navigation item’s icon relative to its label.
- Navigation
Rail Arrangement - Distribution of standard destinations along the vertical axis.
- Pane
Adapt Strategy - The strategy used when resolving a pane from navigation and the directive.
- Pane
Back Behavior - How many destinations a back operation can skip.
- Pane
Expansion Anchor - Anchors relative to the logical extent of one horizontal band excluding its gutters.
- Pane
Overlay Alignment - Logical alignment of a levitated pane in its horizontal band and available height.
- Pane
Placement - A pane’s realized presentation.
- Pane
Role - Roles in a Material three-pane scaffold.
- Progress
Cap - Shape at the ends of a progress stroke.
- Progress
Shape - Straight or Expressive wavy active progress indicator.
- Rail
Mode - Range
Thumb - Identifies the Base slider value represented by a semantic node.
- Scaffold
FabPosition - Positions a scaffold’s floating action within the usable content width.
- Semantic
Tone - Semantic palette shortcut shared across Material components.
- Shape
Fit - How a normalized polygon contour maps into layout bounds.
- Sheet
Edge - Sheet
Mode - Sheet
Placement - Placement of a side sheet relative to its window edge or layout slot.
- 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.
- Snackbar
Result - How a current snackbar left its host’s queue.
- Step
Status - Visual and semantic status of one step in a
Stepper. - Stepper
Orientation - Layout axis for a
Stepper. - Swipe
ToDismiss Value - The resting anchor or a logical dismissal direction.
- TabIndicator
Width - Width of the indicator relative to the selected tab.
- TabVariant
- Text
Field Event - An event emitted by an input.
- Text
Field Label Alignment - Horizontal label alignment. Start and End follow the Material theme direction.
- Text
Field Label Position - Position of the visual label. Filled uses Inside and Outlined uses Cutout by default.
- Text
Field Mask Pattern - Text
Field Obfuscation Mode - Visibility mode for
TextField::secureeditors. - Text
Field Variant - Material text field container treatment. The default is Filled.
- Toggle
Button Variant - Tooltip
Placement - Preferred tooltip side. Start and End resolve against the window’s direction.
Traits§
- Material
Element Ext - Fluent postfix composition helpers for attaching Material badges, tooltips, and context menus to any GPUI element.
- Scrollbar
Handle - A trait for scroll handles that can get and set offset.
Functions§
- current_
base_ theme - Projects the active local Material scope (or window/application theme) into
a
gpui_base::Themewithout mutatinggpui_base::Theme::global. - current_
material_ theme - Resolves the closest Material scope, then the window and application defaults.
- init_
components - Installs component keybindings after initializing the Material root.
- material_
theme - Returns the shared Material theme installed by
MaterialRoot::init. - project_
base_ theme - Projects a
MaterialThemeinto a matchinggpui_base::Themewithout mutating the application-global Base theme. - set_
material_ theme - Updates the application theme and projects its current values into Base. Colors follow the new theme’s Slow Effects motion spec from the displayed palette. Typography and layout apply immediately.
Type Aliases§
- Button
Tone - Semantic palette shortcut for Material buttons and icon buttons.
Backwards-compatible alias for
crate::SemanticTone. Per-instanceButtonColorsandButtonBorderoverrides still take precedence. - Text
Area State - State for editing ordinary multi-line text.
- Text
Field State - State for a single-line text input.