Expand description
Headless form, navigation, and overlay primitives for GPUI.
Applications own presentation. Call init once and host each window’s
content in Root for keyboard navigation and modal focus containment.
Derived from GPUI Kit v0.9.0 under Apache-2.0; the public surface and initialization are scoped to the documented controls and their support APIs.
Re-exports§
pub use observe::TestSupportExt;pub use observe::TestTextExt;
Modules§
- actions
- Common actions shared by keyboard-driven GPUI controls.
- input
- Text input: the shared editing engine and the three states built on it.
Structs§
- Accordion
- An unstyled accordion root. Render each header followed by its matching panel in the state’s item order; applications own item wrappers and all layout.
- Accordion
Header - A heading containing a native button for one item.
- Accordion
Item - One item in a fixed, ordered accordion. Values must be unique.
- Accordion
Panel - An item’s named region, mounted only while that item is open.
- Accordion
State - Retained state for one accordion in one window.
- Alert
Dialog - An unstyled alert dialog for a short decision that needs an explicit response.
- Breadcrumb
- An unstyled navigation landmark containing a
BreadcrumbList. - Breadcrumb
Item - One location in a breadcrumb path, exposed as a native list item.
- Breadcrumb
List - A native list containing
BreadcrumbItemelements in path order. - Button
- An unstyled button that owns interaction, focus, keyboard, and accessibility behavior.
- Button
Styles - Semantic styles supported by
Button. - Calendar
- An unstyled keyboard and accessibility grid. Render a header row containing
seven
Role::ColumnHeadercells, followed by sixRole::Rowcontainers with theirCalendarDaychildren inCalendarState::daysorder. Header and row containers use ordinary GPUI layout, for examplediv().id("calendar-weekdays").role(Role::Row). Native row/column indices are zero based; the header is row 0 and date rows are 1..=6. - Calendar
Day - A date cell composed from Button. It owns selection, focus, disabled state, and native grid-cell metadata; applications provide non-interactive content and styles. The default accessible name is its ISO date, which callers may override with a localized full date.
- Calendar
State - Retained selection and one roving Tab stop for a Gregorian calendar.
- Carousel
- Named carousel region. Arrow keys act only while the region itself has focus,
leaving interactive slide descendants their own key bindings. Use native
Buttons or
CarouselControlfor pointer and keyboard previous/next actions. - Carousel
Control - Previous/next Button composition, including boundary disabled behavior.
- Carousel
Slide - One slide, mounted only while in the current view, with position/count
metadata and a stable focus scope.
Dragging its content by 40 logical pixels snaps once per gesture. GPUI owns
drag cancellation and suppresses click activation after a drag begins.
Axis and direction come from the enclosing
Carousel. There is no inertia or autoplay; use application animation only when the product calls for it. - Carousel
State - Retained state for a fixed ordered set of slides. Labels name each slide.
- Chart
- Unstyled plot interaction region. Grouped and Stacked category centers are evenly spaced across its width; Pie and Radar categories are hit by angle inside the largest centered circle. Hover/click inspect a category; Left/Right and Home/End inspect while the plot holds focus. The current exact values form its native value.
- Chart
Series - A named numeric series. Every series must have one finite value per category.
- Chart
State - A fixed categorical dataset and its interactive inspection/legend state.
The numeric range includes zero and only visible series. The empty or all-zero
dataset uses
0..1; negative values are supported without a false baseline. A Stacked layout’s range covers each category’s positive and negative sums. - Checkbox
- An unstyled checkbox that owns toggle, focus, keyboard, and accessibility behavior.
- Checkbox
Styles - Semantic styles supported by
Checkbox. - Collapsible
- An unstyled disclosure root containing one trigger and its content.
- Collapsible
Content - A named region mounted only while its disclosure is open.
- Collapsible
State - Retained disclosure state and focus for one host in one window.
- Collapsible
Trigger - A native Button that toggles its disclosure and exposes the expanded state. Supply an accessible name and non-interactive children. Button owns activation, disabled handling, focus, and geometry; application styles remain unrestricted.
- Combobox
- An editable input and anchored suggestions with application-owned appearance.
- Combobox
Group - A named result group and heading over the existing Command list navigation. Items with one group label must be contiguous in the collection. Render only this group’s visible indices; empty groups have no layout or native nodes.
- Combobox
Input - The combobox’s InputBase frame around its existing single-line editor. Field-provided name, description, error, and required metadata are preserved.
- Combobox
List - A named scrolling list. Render ComboboxOption children in result order, optionally inside ComboboxGroup wrappers. Keep empty text outside the list.
- Combobox
Option - One searchable option, sharing Command’s navigation and pointer activation. Selected metadata describes the committed value, not the pending highlight.
- Combobox
State - An ordered collection with editable search and committed values.
- Command
- An unstyled command root containing a query input and a result list.
- Command
Group - A named, non-focusable result group with an application-styled heading.
Render only the matching
CommandState::visible_group_indicesoptions. A group without visible matching items contributes no layout or native nodes. - Command
Input - The query’s application-styled InputBase frame and existing native Input.
- Command
List - A named, vertically scrolling result list with no independent Tab stop.
- Command
Option - One action row. The native text input keeps keyboard focus during navigation.
- Command
State - A query input and its fixed collection of searchable actions in one window.
- Context
Menu - A focusable region that opens a command menu on a native secondary click.
- Control
Field - An unstyled field for a checkbox, switch, radio group, select or other non-text control.
- Date
- A representation of a civil date in the Gregorian calendar.
- Date
Picker - An unstyled Button trigger and a date-selection popup.
- Date
Picker State - Coordinates one Calendar with one non-modal Popover in the same window.
- Dialog
- An unstyled modal host.
DialogStateowns its retained lifecycle. - Dialog
Backdrop - Application-owned surface behind the modal popup.
- Dialog
Close - A close button with behavior supplied by the dialog’s retained state.
- Dialog
Description - Visual description slot.
- Dialog
Popup - Application-owned popup; blocks pointer events from reaching the backdrop.
- Dialog
State - Owns a dialog’s open state, stable focus scope and return target.
- Dialog
Title - Visual title slot. Name the modal with
Dialog::accessibility_label. - Direction
Provider - Supplies inherited direction to descendant controls, including nested views.
- Drawer
- An edge-aligned modal whose panel follows outward pointer movement.
- Drawer
State - Retained pointer geometry around the existing modal lifecycle.
- Dropdown
Menu - A native button trigger and anchored, unstyled command menu.
- Edges
- A struct for defining the edges of an element.
- Field
- An unstyled field associated with an existing Input or Textarea state.
- Field
Metadata - Native metadata a
ControlFieldhands to its non-text control. - Field
Styles - Application-owned presentation of the field’s text parts.
- Hover
Card - A native Button with an application-owned, noninteractive rich preview.
- Hover
Card State - Retained visibility for a rich, noninteractive preview of a Button’s action.
- Input
- An unstyled single-line text input.
- Input
Accessibility - Accessibility presentation for the editor’s existing keyboard-focus boundary.
- Input
Base - The foundational input frame.
- Input
Colors - Baseline colors for text editing, independent of any application design system.
- Input
Editor Style - Application-owned colors and highlight resolver consumed by editor painting.
- Input
Otp - A single accessible input with application-rendered visual digit slots.
- Input
OtpEvent - A committed user edit. Completion means all slots contain a digit, not that the application has verified the code.
- Input
OtpSlot - Presentation facts for one slot. Slots never own independent editor or
focus state. Use
indexto add application-specific grouping and spacing. - Input
OtpState - One ASCII-digit code, backed by the same editor as
Input. - Input
Styles - Label
- An unstyled text label that focuses an application-supplied control.
- Menu
Item - One command in a menu’s fixed, ordered collection. Values must be unique.
- Menu
Option - One command’s application-styled surface, with library-owned interaction.
- Menu
State - Retained commands and cursor for one non-modal menu in one window.
- Menu
Submenu - One submenu row and its nested command surface.
- Menubar
- Semantic menubar scope. Supply
MenubarMenuchildren in collection order. - Menubar
Item - One top-level command menu. Command values and events belong to
menu. - Menubar
Menu - One top-level trigger and its command surface.
- Menubar
State - Fixed top-level menus for a single menubar in one window.
- Message
Scroller - An unstyled vertical message viewport with stable keyed scroll anchoring.
- Message
Scroller State - Retained scrolling state for one conversation in one viewport.
- Navigation
Menu - A named navigation landmark. Supply
NavigationMenuEntrychildren in order. - Navigation
Menu Entry - A top-level link or disclosure panel. Presentation belongs to the caller.
- Navigation
Menu Item - One top-level destination or disclosure trigger in a fixed collection.
- Navigation
Menu Link - A panel link that closes navigation before reporting its destination.
- Navigation
Menu State - Retained navigation for one window. Applications own routing and current-page state.
- Popover
- An unstyled trigger and non-modal dialog anchored by
Popup. - Popover
State - Owns one popover’s open state, disabled state, trigger, and content focus.
- Popup
- An unstyled trigger and anchored popup host.
- Positioner
- An unstyled element that positions its children as an anchored popup.
- Progress
- An unstyled progress indicator with an application-controlled percentage.
- Questionnaire
- An unstyled semantic group for the active question, review, or result.
- Questionnaire
State - A small, presentation-independent questionnaire controller.
- Radio
Group - An unstyled radio group. Render one
RadioOptionfor every item, in order, using this group’s state. Children supply presentation; the group supplies exclusive selection, keyboard navigation, and accessibility semantics. - Radio
Group State - Retained exclusive selection and focus for one rendered radio group.
- Radio
Item - One option in a radio group’s fixed, ordered collection. Values must be unique.
- Radio
Option - One unstyled radio option. Its state supplies the label, checked state, focus, and activation; applications provide the visual indicator and other content.
- Resizable
- An unstyled panel group. Give its frame bounded dimensions, supply one
Self::panelper configured panel in order, and size each divider throughSelf::handle. Horizontal groups use the handle’s width; vertical groups use its height. - Resizable
Handle - One focusable divider. Supply a non-interactive visual grip and an accessible label describing the panel before it. Arrow keys along the group’s layout axis adjust that panel by two percentage points; Home and End reach its smallest and largest allowed sizes; Enter collapses or restores a collapsible panel. Other-axis keys propagate normally.
- Resizable
Panel - One panel’s initial size and constraints, as fractions of the usable space, with optional pixel limits that apply once the group has been laid out.
- Resizable
State - Retained panel sizes and divider focus for one mounted panel group.
- Resolved
Position - The bounds a popup resolved to, and the side it ended up on.
- Root
- The window’s content and overlay host, independent of any styled component library.
- Scroll
Area - A scrollable viewport with application-owned content and presentation.
- Scroll
Bounce - Adds vertical touch overscroll to an existing scroll viewport.
- Scroll
Bounce Motion - Motion tokens for
ScrollBounce: how far a drag stretches the viewport past an edge, and how quickly a released edge returns. - Scrollbar
- Scrollbar control for scroll-area or a uniform-list.
- Scrollbar
Motion - Motion tokens used by
Scrollbar. - Scrollbar
Styles - Typed paint styles supported by
Scrollbar. - Scrollbar
Theme - Global defaults used by
crate::Scrollbar. - Scrollbar
Thumb Style - Paint-only styles for a scrollbar thumb.
- Scrollbar
Track Style - Paint-only styles for a scrollbar track.
- Search
Item - One value, label, and searchable aliases in a fixed collection. Values must be unique.
- Select
- A select root with application-owned trigger and option-list presentation.
- Select
Item - One option in a select. Its unique value identifies it across list updates.
- Select
Option - One unstyled option. Selection, hover, disabled and activation come from state.
- Select
State - Retained selection, keyboard cursor, disabled state and popup focus.
- Separator
- An unstyled, non-interactive separator between regions of content.
- Slider
- An unstyled slider group and thumb-center travel rail.
- Slider
State - Retained ordered values, thumb focus, and pointer geometry for one slider in one window.
- Slider
Thumb - One independently focusable slider value. Render inside its matching
Sliderand give each thumb an accessible name distinguishing its purpose. - State
Style - A semantic-state style builder.
- Switch
- An unstyled binary control that owns switch interaction and semantics.
- Switch
Styles - Semantic root styles supported by
Switch. - Tab
- An unstyled trigger for one tab. The state owns its label, selection and focus. Applications supply its visual content and state styling.
- TabItem
- One tab in a fixed, ordered collection. Values must be unique.
- TabList
- The unstyled list of tab triggers. Render one
Tabper item in order. - TabPanel
- Content for one tab, mounted only while that tab is selected.
- Table
- An unstyled table with one shared column definition.
- Table
Caption - A noninteractive caption rendered after a Table’s rows.
- Table
Cell - A cell whose contents and presentation belong to the application.
- Table
Column - One column track, shared by every row in a
Table. - Table
Row - A table-owned row. Build its cells with
Self::cellorSelf::cells. - Tabs
State - Retained selection and focus for one tab list and its panels in one window.
- Textarea
- An unstyled ordinary multi-line text input.
- Theme
- Construct with
Theme::defaultand assign fields; new fields may be added without a breaking change. - Toast
- A nonmodal status surface. The consumer chooses its location and content.
- Toast
Close - A normal Button whose activation safely dismisses this notification.
- Toast
Key - Identifies one notification pushed to a
ToasterState. - Toast
State - One retained notification. Applications own its message, actions and stacking.
- Toaster
- The named region holding a
ToasterState’s visible notifications, newest first. The application builds eachToastand places the region. - Toaster
State - A retained stack of notifications, each with its own
ToastState. - Toggle
- An unstyled toggle whose pressed value belongs to the application.
- Toggle
Group - An unstyled selection group composed from
ToggleOptionchildren. Render one option per item in collection order; axis changes keyboard and accessibility orientation, while application styles choose the actual layout. - Toggle
Group State - Retained selection and focus for one group in one window.
- Toggle
Item - An item in a fixed, ordered group. Values must be unique.
- Toggle
Option - One group option, composed from
Togglewith group-owned state and focus. Supply non-interactive content; its label and pressed value come from the state. - Tooltip
- A Button with a noninteractive text description on hover and keyboard focus.
- Tooltip
State - Retained visibility for a tooltip attached to an existing button focus handle.
- Touch
Handle - The grab handle at one end of a touch selection: a bar down the caret line with a knob at its outer end, the start’s above and the end’s below.
- Touch
Selection Snapshot - Where a touch selection’s ends are laid out this frame, and what the gesture is doing to them.
Enums§
- Accordion
Event - The open values after one change, in the original item order. An empty collection means all items are closed.
- Align
- Alignment of a popup along the side it is placed on.
- Calendar
Event - Emitted once when user activation changes the selected date or dates.
- Calendar
Selection - A calendar’s selection mode and retained value.
- Carousel
Event - Chart
Event - Chart
Layout - How categories and visible series share the plot.
- Checkbox
State - The semantic value exposed by an unstyled
Checkbox. - Collapsible
Event - Emitted after the open state changes. Repeated requests emit no event.
- Combobox
Event - Committed values after a user selection, removal, or clear, in item order.
- Command
Event - An explicit command activation. The application decides what it does.
- Date
Picker Event - Emitted after user activation changes the selection. Single and complete-range selections close the popup before publishing; partial ranges and multiple selections keep the popup open.
- Dialog
Change Reason - The interaction that closed a dialog.
- Dialog
Event - A notification emitted after the retained lifecycle has changed.
- Direction
- The logical order of horizontal content. Vertical order is unchanged.
- Menu
Event - Emitted once by the top-level menu after a leaf command closes the entire menu chain and restores focus. Submenu trigger rows never emit commands.
- Navigation
Menu Event - Destination activation after closing any open panel and restoring focus.
- Placement
- A enum for defining the placement of the element.
- Questionnaire
Stage - The current part of a linear questionnaire.
- Radio
Group Event - Emitted once when a user selects a different value.
- Reduce
Motion Preference - The source and value of the application’s reduced-motion preference.
- Resizable
Event - Emitted once when the panel layout changes, including programmatic updates. Sizes are fractions of the usable space, in panel order, and sum to one.
- Role
Override - Scrollbar
Axis - Scrollbar axis.
- Scrollbar
Entrance - How a scrollbar becomes visible.
- Scrollbar
Mode - Scrollbar show mode.
- Select
Event - Emitted once when a user commits a different value.
- Selection
Edge - One end of a selection, as a touch handle grabs it.
- Side
- A enum for defining the side of the element.
- Slider
Event - The ordered values after one change, including programmatic changes.
- Tabs
Event - Emitted once after a different enabled tab becomes selected.
- Toast
Dismiss Reason - Toast
Event - Toggle
Group Event - The selected values after one option changes, in the original item order.
- Weekday
- A representation for the day of the week.
Constants§
- POPUP_
PRIORITY - Deferred paint priority for interactive surfaces that must appear above dialogs.
Traits§
- AxisExt
- A trait to extend the
Axisenum with utility methods. - Element
Ext - Extends a GPUI parent element with post-layout prepaint observation.
- Focus
Trap Element - An extension trait to add
focus_trapfunctionality to interactive elements. - Interactive
Element Ext - Length
Ext - A trait to extend the
Lengthenum with utility methods. - Ongoing
Scroll Ext - gpui delimits scroll gestures with
std::time::Instant, which is unimplemented on wasm32: the first wheel event over an axis-locked scroll area panics with “time not implemented on this platform” and takes the whole application down, leaving the canvas unresponsive. Losing the axis lock in the browser is by far the lesser cost, so the locks below are no-ops there. - Scrollbar
Handle - A trait for scroll handles that can get and set offset.
- Selectable
- An element or component that exposes controlled selected state.
- Styled
Ext - Test
Support Ext - Registers an existing element for UI queries. Its native accessibility properties are read automatically; there are no test-only property setters.
- Test
Text Ext - Records the text an element displays, for text queries in UI tests. Text components call it with the text they render, so plain text needs no element id.
Functions§
- apply_
system_ reduce_ motion - Reads the operating system’s reduced-motion preference into
App::set_reduce_motion. - box_
shadow - h_flex
- A row that centers its children on the cross axis.
- init
- Register keyboard actions and shared input/focus state before creating views.
- is_
mobile - Whether the application is compiled for iOS or Android.
- parse_
date_ text - Reads one typed date for a text field beside a picker.
- set_
reduce_ motion_ preference - Selects the application’s reduced-motion preference.
- styled_
ext_ reflection_ methods - v_flex
- A column whose children stretch across the cross axis.
Type Aliases§
- Input
State - State for a single-line text input.
- Textarea
State - State for editing ordinary multi-line text.