Skip to main content

Crate gpui_deck

Crate gpui_deck 

Source
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.
AccordionHeader
A heading containing a native button for one item.
AccordionItem
One item in a fixed, ordered accordion. Values must be unique.
AccordionPanel
An item’s named region, mounted only while that item is open.
AccordionState
Retained state for one accordion in one window.
AlertDialog
An unstyled alert dialog for a short decision that needs an explicit response.
Breadcrumb
An unstyled navigation landmark containing a BreadcrumbList.
BreadcrumbItem
One location in a breadcrumb path, exposed as a native list item.
BreadcrumbList
A native list containing BreadcrumbItem elements in path order.
Button
An unstyled button that owns interaction, focus, keyboard, and accessibility behavior.
ButtonStyles
Semantic styles supported by Button.
Calendar
An unstyled keyboard and accessibility grid. Render a header row containing seven Role::ColumnHeader cells, followed by six Role::Row containers with their CalendarDay children in CalendarState::days order. Header and row containers use ordinary GPUI layout, for example div().id("calendar-weekdays").role(Role::Row). Native row/column indices are zero based; the header is row 0 and date rows are 1..=6.
CalendarDay
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.
CalendarState
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 CarouselControl for pointer and keyboard previous/next actions.
CarouselControl
Previous/next Button composition, including boundary disabled behavior.
CarouselSlide
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.
CarouselState
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.
ChartSeries
A named numeric series. Every series must have one finite value per category.
ChartState
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.
CheckboxStyles
Semantic styles supported by Checkbox.
Collapsible
An unstyled disclosure root containing one trigger and its content.
CollapsibleContent
A named region mounted only while its disclosure is open.
CollapsibleState
Retained disclosure state and focus for one host in one window.
CollapsibleTrigger
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.
ComboboxGroup
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.
ComboboxInput
The combobox’s InputBase frame around its existing single-line editor. Field-provided name, description, error, and required metadata are preserved.
ComboboxList
A named scrolling list. Render ComboboxOption children in result order, optionally inside ComboboxGroup wrappers. Keep empty text outside the list.
ComboboxOption
One searchable option, sharing Command’s navigation and pointer activation. Selected metadata describes the committed value, not the pending highlight.
ComboboxState
An ordered collection with editable search and committed values.
Command
An unstyled command root containing a query input and a result list.
CommandGroup
A named, non-focusable result group with an application-styled heading. Render only the matching CommandState::visible_group_indices options. A group without visible matching items contributes no layout or native nodes.
CommandInput
The query’s application-styled InputBase frame and existing native Input.
CommandList
A named, vertically scrolling result list with no independent Tab stop.
CommandOption
One action row. The native text input keeps keyboard focus during navigation.
CommandState
A query input and its fixed collection of searchable actions in one window.
ContextMenu
A focusable region that opens a command menu on a native secondary click.
ControlField
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.
DatePicker
An unstyled Button trigger and a date-selection popup.
DatePickerState
Coordinates one Calendar with one non-modal Popover in the same window.
Dialog
An unstyled modal host. DialogState owns its retained lifecycle.
DialogBackdrop
Application-owned surface behind the modal popup.
DialogClose
A close button with behavior supplied by the dialog’s retained state.
DialogDescription
Visual description slot.
DialogPopup
Application-owned popup; blocks pointer events from reaching the backdrop.
DialogState
Owns a dialog’s open state, stable focus scope and return target.
DialogTitle
Visual title slot. Name the modal with Dialog::accessibility_label.
DirectionProvider
Supplies inherited direction to descendant controls, including nested views.
Drawer
An edge-aligned modal whose panel follows outward pointer movement.
DrawerState
Retained pointer geometry around the existing modal lifecycle.
DropdownMenu
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.
FieldMetadata
Native metadata a ControlField hands to its non-text control.
FieldStyles
Application-owned presentation of the field’s text parts.
HoverCard
A native Button with an application-owned, noninteractive rich preview.
HoverCardState
Retained visibility for a rich, noninteractive preview of a Button’s action.
Input
An unstyled single-line text input.
InputAccessibility
Accessibility presentation for the editor’s existing keyboard-focus boundary.
InputBase
The foundational input frame.
InputColors
Baseline colors for text editing, independent of any application design system.
InputEditorStyle
Application-owned colors and highlight resolver consumed by editor painting.
InputOtp
A single accessible input with application-rendered visual digit slots.
InputOtpEvent
A committed user edit. Completion means all slots contain a digit, not that the application has verified the code.
InputOtpSlot
Presentation facts for one slot. Slots never own independent editor or focus state. Use index to add application-specific grouping and spacing.
InputOtpState
One ASCII-digit code, backed by the same editor as Input.
InputStyles
Label
An unstyled text label that focuses an application-supplied control.
MenuItem
One command in a menu’s fixed, ordered collection. Values must be unique.
MenuOption
One command’s application-styled surface, with library-owned interaction.
MenuState
Retained commands and cursor for one non-modal menu in one window.
MenuSubmenu
One submenu row and its nested command surface.
Menubar
Semantic menubar scope. Supply MenubarMenu children in collection order.
MenubarItem
One top-level command menu. Command values and events belong to menu.
MenubarMenu
One top-level trigger and its command surface.
MenubarState
Fixed top-level menus for a single menubar in one window.
MessageScroller
An unstyled vertical message viewport with stable keyed scroll anchoring.
MessageScrollerState
Retained scrolling state for one conversation in one viewport.
NavigationMenu
A named navigation landmark. Supply NavigationMenuEntry children in order.
NavigationMenuEntry
A top-level link or disclosure panel. Presentation belongs to the caller.
NavigationMenuItem
One top-level destination or disclosure trigger in a fixed collection.
NavigationMenuLink
A panel link that closes navigation before reporting its destination.
NavigationMenuState
Retained navigation for one window. Applications own routing and current-page state.
Popover
An unstyled trigger and non-modal dialog anchored by Popup.
PopoverState
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.
QuestionnaireState
A small, presentation-independent questionnaire controller.
RadioGroup
An unstyled radio group. Render one RadioOption for every item, in order, using this group’s state. Children supply presentation; the group supplies exclusive selection, keyboard navigation, and accessibility semantics.
RadioGroupState
Retained exclusive selection and focus for one rendered radio group.
RadioItem
One option in a radio group’s fixed, ordered collection. Values must be unique.
RadioOption
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::panel per configured panel in order, and size each divider through Self::handle. Horizontal groups use the handle’s width; vertical groups use its height.
ResizableHandle
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.
ResizablePanel
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.
ResizableState
Retained panel sizes and divider focus for one mounted panel group.
ResolvedPosition
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.
ScrollArea
A scrollable viewport with application-owned content and presentation.
ScrollBounce
Adds vertical touch overscroll to an existing scroll viewport.
ScrollBounceMotion
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.
ScrollbarMotion
Motion tokens used by Scrollbar.
ScrollbarStyles
Typed paint styles supported by Scrollbar.
ScrollbarTheme
Global defaults used by crate::Scrollbar.
ScrollbarThumbStyle
Paint-only styles for a scrollbar thumb.
ScrollbarTrackStyle
Paint-only styles for a scrollbar track.
SearchItem
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.
SelectItem
One option in a select. Its unique value identifies it across list updates.
SelectOption
One unstyled option. Selection, hover, disabled and activation come from state.
SelectState
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.
SliderState
Retained ordered values, thumb focus, and pointer geometry for one slider in one window.
SliderThumb
One independently focusable slider value. Render inside its matching Slider and give each thumb an accessible name distinguishing its purpose.
StateStyle
A semantic-state style builder.
Switch
An unstyled binary control that owns switch interaction and semantics.
SwitchStyles
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 Tab per item in order.
TabPanel
Content for one tab, mounted only while that tab is selected.
Table
An unstyled table with one shared column definition.
TableCaption
A noninteractive caption rendered after a Table’s rows.
TableCell
A cell whose contents and presentation belong to the application.
TableColumn
One column track, shared by every row in a Table.
TableRow
A table-owned row. Build its cells with Self::cell or Self::cells.
TabsState
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::default and assign fields; new fields may be added without a breaking change.
Toast
A nonmodal status surface. The consumer chooses its location and content.
ToastClose
A normal Button whose activation safely dismisses this notification.
ToastKey
Identifies one notification pushed to a ToasterState.
ToastState
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 each Toast and places the region.
ToasterState
A retained stack of notifications, each with its own ToastState.
Toggle
An unstyled toggle whose pressed value belongs to the application.
ToggleGroup
An unstyled selection group composed from ToggleOption children. Render one option per item in collection order; axis changes keyboard and accessibility orientation, while application styles choose the actual layout.
ToggleGroupState
Retained selection and focus for one group in one window.
ToggleItem
An item in a fixed, ordered group. Values must be unique.
ToggleOption
One group option, composed from Toggle with 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.
TooltipState
Retained visibility for a tooltip attached to an existing button focus handle.
TouchHandle
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.
TouchSelectionSnapshot
Where a touch selection’s ends are laid out this frame, and what the gesture is doing to them.

Enums§

AccordionEvent
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.
CalendarEvent
Emitted once when user activation changes the selected date or dates.
CalendarSelection
A calendar’s selection mode and retained value.
CarouselEvent
ChartEvent
ChartLayout
How categories and visible series share the plot.
CheckboxState
The semantic value exposed by an unstyled Checkbox.
CollapsibleEvent
Emitted after the open state changes. Repeated requests emit no event.
ComboboxEvent
Committed values after a user selection, removal, or clear, in item order.
CommandEvent
An explicit command activation. The application decides what it does.
DatePickerEvent
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.
DialogChangeReason
The interaction that closed a dialog.
DialogEvent
A notification emitted after the retained lifecycle has changed.
Direction
The logical order of horizontal content. Vertical order is unchanged.
MenuEvent
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.
NavigationMenuEvent
Destination activation after closing any open panel and restoring focus.
Placement
A enum for defining the placement of the element.
QuestionnaireStage
The current part of a linear questionnaire.
RadioGroupEvent
Emitted once when a user selects a different value.
ReduceMotionPreference
The source and value of the application’s reduced-motion preference.
ResizableEvent
Emitted once when the panel layout changes, including programmatic updates. Sizes are fractions of the usable space, in panel order, and sum to one.
RoleOverride
ScrollbarAxis
Scrollbar axis.
ScrollbarEntrance
How a scrollbar becomes visible.
ScrollbarMode
Scrollbar show mode.
SelectEvent
Emitted once when a user commits a different value.
SelectionEdge
One end of a selection, as a touch handle grabs it.
Side
A enum for defining the side of the element.
SliderEvent
The ordered values after one change, including programmatic changes.
TabsEvent
Emitted once after a different enabled tab becomes selected.
ToastDismissReason
ToastEvent
ToggleGroupEvent
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 Axis enum with utility methods.
ElementExt
Extends a GPUI parent element with post-layout prepaint observation.
FocusTrapElement
An extension trait to add focus_trap functionality to interactive elements.
InteractiveElementExt
LengthExt
A trait to extend the Length enum with utility methods.
OngoingScrollExt
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.
ScrollbarHandle
A trait for scroll handles that can get and set offset.
Selectable
An element or component that exposes controlled selected state.
StyledExt
TestSupportExt
Registers an existing element for UI queries. Its native accessibility properties are read automatically; there are no test-only property setters.
TestTextExt
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§

InputState
State for a single-line text input.
TextareaState
State for editing ordinary multi-line text.