Skip to main content

Crate sui

Crate sui 

Source
Expand description

Public Rust facade for SUI.

Most applications can import prelude and construct an App with one or more Window values. Lower-level runtime, scene, renderer, and widget types are re-exported for custom widgets, embedding, tests, and tooling.

use sui::prelude::*;

fn main() -> Result<()> {
    App::new()
        .main_window("Hello SUI", Label::new("Ready"))
        .run()
}

Re-exports§

pub use app::UiHandle;
pub use app::App;
pub use app::ResourceRegistry;
pub use app::Window;

Modules§

app
User-facing application, window, resource, and wake-handle builders.
composites
Composite widgets and application-shell building blocks.
containers
Layout and containment widgets.
controls
Primitive controls, labels, inputs, and icons.
prelude
Common imports for ordinary SUI application and widget code.

Structs§

AccessibilityIssue
AccessibilitySnapshot
ActionCard
ActionTilePaint
AdaptiveBreakpoints
Width thresholds used by adaptive widgets.
AdaptiveView
Retains one subtree per presentation class and switches between them based on the space allocated by the parent.
Align
AnimatedValue
AnimationBinding
AnimationBindingInvalidation
AnimationDocument
AnimationDocumentFormatError
AnimationEditorState
AnimationPlayer
AnimationPropertyPath
AnimationSelection
AnimationTargetId
AnimationTick
Application
Lower-level application builder for runtime and platform integration.
ArrangeCtx
AspectRatio
Constrains one retained child to an aspect ratio without specializing it as an image or media widget.
AsyncTaskInspectorSnapshot
AsyncWakeToken
Background
BasicSyntaxHighlighter
Lightweight dependency-free lexer used by the default code-block renderer.
Blink
Border
BottomSheet
A modal surface anchored to the bottom edge of its allocated viewport.
Breadcrumb
BreadcrumbItem
BrowserTabBar
BrushPreview
BrushPreviewSpec
Button
CacheMetrics
CacheMetricsDelta
CalloutPaint
Canvas
CanvasAppearance
Widget-owned canvas color overrides. Unset fields resolve from common semantic theme roles on every paint, preserving live theme switching.
CanvasRuler
CanvasRulerAppearance
CanvasStroke
CanvasSurface
Reusable paint-only canvas background and world-space transform.
CanvasViewport
CanvasZoomContext
Checkbox
CheckboxIndicatorState
Clip
Clipboard
Shared handle to the clipboard service.
CodePanelPaint
CodeTextLine
CodeTextPaint
CodeTextSpan
CollectionAnchor
CollectionExtentIndex
Variable-height prefix-sum index used by virtual collection policies.
CollectionWindow
Describes the loaded slice of a potentially larger collection.
Color
ColorPalette
ColorPaletteSwatch
ColorPicker
ColorPickerAppearance
Widget-owned color-tool paint overrides. The default appearance is derived from common semantic theme roles rather than global picker-specific tokens.
ColorSwatch
Command
Borrowed view of a command while it is delivered on the UI thread.
CommandButtonPaint
CommandCtx
Context supplied to window and application command controllers.
CommandDispatchSample
One application-command delivery attempt retained in the next frame.
CommandGroup
CommandKey
A process-local, strongly typed command identifier.
CommandPalette
Modal presentation shell for application command search and execution.
CommandSender
Cloneable, thread-safe producer for application commands.
CompiledClip
CompiledTimeline
CompiledTrack
ConstraintQuery
Serializable, locally evaluated container query.
ConstraintView
Retains each declarative query branch and visits only the first matching one.
Constraints
ContextMenu
ControlMetrics
ControlPalette
ControlTypography
CoverageDots
CoverageDotsConfig
CustomEvent
DateTimeInput
A lightweight single-line local date/time field. Values remain strings so applications can choose their own parsing, timezone, and validation rules; the suggested format is YYYY-MM-DD HH:MM.
DefaultTheme
DesktopAutomationConfig
DesktopExtensionContext
Read-only state supplied to a DesktopExtension update.
DesktopPlatform
DesktopWindow
A live winit window exposed to a desktop extension.
DetailRow
Dialog
DirtyRegion
DisclosureButtonPaint
Dock
Vertical dock layout with optional fixed-height top and bottom slots.
DockFloatingGroup
A tab group floating above the docked graph inside the same SUI window.
DockLayoutError
Validation or mutation failure for a docking layout.
DockPanel
DockPanelId
Stable application-defined identity for one dockable panel.
DockWorkspace
Retained editor workspace with a split/tab dock graph and same-window floating panels.
DockWorkspaceSnapshot
Plain persistence boundary for a docking workspace.
DockWorkspaceState
Cloneable observable state for DockWorkspace.
DpiInfo
DragDropHost
DragDropScope
DragEvent
DragPreview
DragScopeId
DragSessionId
Draggable
DropTarget
EffectToken
EmbeddedSvgImageResource
EmptyState
EmptyStatePaint
Error
EventCtx
EventRouteStep
EventRouteTraceSample
Privacy-safe event routing trace. Event payloads and typed characters are intentionally not retained.
FieldGroup
FileDialogFilter
FileDialogRequest
FileDialogSelection
FixedPaneSplit
Flex
FlexItem
FlexItemLayout
FlexLayout
FlexLineLayout
FlexStyle
FloatingStack
FloatingViewConfig
FloatingViewSnapshot
FloatingWorkspace
FloatingWorkspaceState
FocusScope
Retains focus history for a stable child subtree.
FocusScopeState
Shared retained focus history for a FocusScope.
FocusState
FontFamilyStack
An ordered, theme-owned font-family preference list.
FontFeature
A single OpenType feature setting: a 4-byte tag plus a value (0 disables, 1 enables, and larger values select an alternate/parameter for features that take one).
FontFeatures
An ordered collection of OpenType feature settings applied to a text run. Later settings for the same tag take precedence in the shaper.
FontHandle
FontRegistry
FontWeight
OpenType weight axis value. Conventional named weights span 100..=900; for variable fonts any value in the font’s wght range is valid.
FormRow
FormSection
FramePhaseSample
FrameSchedule
FramedField
A reusable field frame for compound editors such as search/composer rows.
GradientStop
Grid
Retained explicit grid container backed by the renderer-independent sui-layout track solver.
GridCell
GridItem
GridItemLayout
GridLayout
GridPlacement
GridStyle
HdrColorRoles
HdrEffectTokens
HdrLuminanceTokens
HdrMaterialTokens
HdrPolicyTokens
HdrThemeTokens
HeadlessPlatform
Icon
IconButton
IconButtonPaint
Image
ImageHandle
ImageRegistry
ImageSource
Insets
InspectorHistorySnapshot
IntrinsicSize
Minimum and preferred content extents reported by a widget along one axis.
InvalidationRequest
InvalidationTraceSample
The origin and optional caller explanation for a scheduled invalidation.
KeyboardEvent
KeyedChildren
Layout-neutral retained child collection reconciled by stable application keys.
KeyedReconcile
Keyframe
KeyframeSelection
Label
LayerList
LayerListItem
LayerListReorderChange
LayerOptions
LayoutContext
LayoutTransition
Animates a retained subtree from its previous arranged origin to its new origin while layout itself immediately settles at the destination.
LeadingLabelCellPaint
Link
ListItem
ListView
LocalClipboardBackend
In-process clipboard storage used when no platform backend is installed.
MasterDetail
Shows master and detail side-by-side when space permits, and converts to a focus-restoring navigation stack under compact constraints.
MasterDetailState
Cloneable navigation state shared by a master-detail layout and the app.
MaterialToken
MeasureCtx
MeasuredBottomDock
Vertical dock layout where the bottom child is measured to its natural height.
Menu
MenuItem
Modifiers
MotionScalar
NativeFileDialogs
NotificationCenter
Thread-safe producer for transient, window-hosted notifications.
NotificationHost
Window-level visual and semantic host for a NotificationCenter.
NotificationId
NumberInput
ObservableChange
Metadata emitted when an observable value changes.
Observer
Cloneable change observer used by observable implementations.
OverlayCollisionPolicy
OverlayDismissPolicy
OverlayDismissRequest
OverlayFocusBehavior
Focus behavior shared by every transient presentation policy.
OverlayHost
Defines an independent overlay stacking root.
OverlayManagerSnapshot
OverlayOptions
Runtime behavior declared by the logical owner of an overlay.
OverlayPlacement
OverlayPlacementRequest
OverlayPlacementResult
OverlaySnapshot
OverlayTraceSample
Padding
PaintCtx
PanelSection
PasswordInput
A single-line text input that masks its visible value while retaining the same selection, clipboard, IME, and change-callback behavior as TextInput.
Path
PathBuilder
PersistentTextLayout
PixelCanvas
PixelCanvasAppearance
PixelCanvasExportSnapshot
PixelCanvasState
PlacementBadge
PlacementBadgePaint
PlatformFile
PlatformWindow
PlaybackState
Point
PointerButtons
PointerEvent
Popover
PresentationLatencyDiagnostics
PresetStrip
ProgressBar
PropertyRow
Pulse
RadioButton
RadioGroup
RawMouseMotionEvent
Device-relative mouse motion in the host’s raw, device-specific units.
ReactiveInvalidationSample
RebuildOnChange
Hosts a child subtree that is rebuilt whenever a caller-supplied key changes.
RebuildOnConstraints
Hosts a child subtree that is rebuilt whenever layout constraints resolve to a new key.
Rect
RegisteredExternalImage
Renderer-neutral metadata for an image whose pixels are owned outside the frame’s CPU image registry.
RegisteredFont
RegisteredImage
RenderDiagnostics
RenderOutput
RendererCapabilities
RendererInterop
RendererSubmissionDiagnostics
ReorderableList
ReorderableListChange
ResolvedEffectStyle
ResolvedHdrStyle
ResolvedMaterialStyle
ResolvedTextFace
ResponsiveSidebar
A stable sidebar/content layout that becomes an overlay drawer in compact constraints and a collapsible rail or inline pane in wider constraints.
ResponsiveSidebarSnapshot
ResponsiveSidebarState
Cloneable application-owned state for a responsive sidebar.
RetainedPacketRebuildDiagnostics
RichAttachment
RichBlockId
Stable identity for a block in a RichDocumentModel.
RichDocumentBlock
RichDocumentModel
RichDocumentRenderContext
Context passed to an application-defined rich-document block renderer.
RichDocumentRendererRegistry
Registry of block renderers keyed by architecture-neutral names.
RichDocumentSnapshot
RichDocumentSpan
RichDocumentUpdate
RichDocumentView
Retained, selectable, incrementally updating rich-document widget.
RichDocumentViewState
Shareable retained state for a RichDocumentView.
RichExtensionBlock
Application-defined structured block rendered through a registry entry.
RichInlineImage
RichInlineStyle
RichLink
RichListItem
RichSyntaxSpan
RichText
RichTextSourceMap
Original source plus the mapping needed to copy source-preserving rich-text selections.
RichTextSourceSpan
Maps byte ranges in rendered rich text back to the original source.
Runtime
RuntimeApplication
SafeArea
Insets one retained child by the current window’s safe area.
SafeAreaEdges
Selects which edges of SafeArea consume the platform-provided insets.
SafeAreaInsets
SampleBatch
SampleBuffer
SampledAnimationValue
Scene
SceneFrame
SceneStatistics
SchedulerInspectorSnapshot
ScrollBar
ScrollState
ScrollView
SectionLabel
SectionLabelPaint
SectionPanelGeometry
SectionPanelPaint
SegmentedControl
SegmentedControlItem
Select
SelectionChange
SelectionEntry
SelectionOrder
SelectionOwnerId
SelectionPoint
SelectionScope
Selector
Equality-deduplicated derived observable.
SemanticColorToken
SemanticRegion
SemanticsCtx
SemanticsEvent
An assistive-technology action directed at a semantic node.
SemanticsNode
SemanticsRelations
SemanticsState
SemanticsTextRange
Separator
ShadowParams
ShapedGlyph
ShapedText
ShapedTextWindow
SheetState
Cloneable presentation state shared by a sheet and application controls.
SideSheet
An overlay panel anchored to a viewport edge.
Signal
Cloneable observable storage with equality-deduplicated writes.
SignalMeter
SimpleColorPicker
SingleChild
Size
SizedBox
Slider
SourceId
Stable identity for one observable source.
Spinner
SplitState
Cloneable, observable split-pane state.
SplitStateSnapshot
SplitView
SpringF32
Stack
StackHostOptions
StackSurfaceOptions
StatusBadge
StatusBar
StatusBarHost
StatusBarSegment
StrokeStyle
Style
Minimal shared style values for custom facade-level components.
Subscription
Keeps an observable subscription alive.
Surface
SurfaceId
SurfacePalette
Switch
SwitchView
TabBar
TabBarItem
One navigation tab, measured and painted as a single optional-icon + label item.
Table
TableColumn
TableRow
Tabs
TextArea
TextBlockPaint
TextCacheDeltaDiagnostics
TextCacheDiagnostics
TextCellPaint
TextCluster
TextCursor
TextDocument
TextGlyphInstance
TextInput
TextLayout
TextLayoutHandle
TextLayoutId
TextLayoutMetadata
TextLayoutRegistry
TextLayoutRequest
TextLayoutRun
TextLayoutVersion
TextLayoutView
TextLine
TextLineWindow
TextMeasurement
TextParagraph
TextParagraphLayout
TextParagraphStyle
TextRenderPolicy
TextRun
TextRunView
TextSelection
TextSelectionGeometry
TextSelectionInfo
TextSpan
TextSpanId
TextStyle
TextSurface
TextSurfaceStyleOverlay
TextSurfaceStyleSpan
Theme
Application-level colors, built-in widget theme, and custom extensions.
ThemeAspectRatios
ThemeBlurScale
ThemeBreakpoints
ThemeColors
ThemeContainers
ThemeExtensions
Type-indexed storage for application-specific theme values.
ThemeFontFamilies
ThemeFontStack
ThemeFontWeights
ThemeLeading
ThemeMotion
Motion design tokens: a shared vocabulary of animation durations and easing curves so widgets and applications animate consistently.
ThemePerspective
ThemeRadii
ThemeShadow
ThemeShadowLayer
ThemeShadows
ThemeTextScale
ThemeTextToken
ThemeTracking
Timeline
TimelinePlayer
TimelineSnap
TimelineTick
TimerInspectorSnapshot
TimerToken
ToolPalette
ToolPaletteItem
Toolbar
Tooltip
Track
TrailingSlotRow
Transform
TransientNotification
Transition
TreeItem
TreeView
Vector
VirtualCollectionModel
Cloneable observable collection with stable keys and incremental changes.
VirtualList
Data-backed retained virtual list with stable keyed row identity.
VirtualListState
VirtualScrollView
VirtualTable
VirtualTableColumn
VirtualTableRowContext
VirtualTableState
Retained interaction state shared by rebuilt VirtualTable instances.
VirtualViewportSnapshot
Observable projection of a virtual collection viewport.
Waker
A cheap, cloneable, Send handle that wakes the running desktop UI from any thread. Pending wake calls are coalesced into one event-loop signal. This is a scheduler primitive: it does not synthesize or route a widget event.
WeakObserver
Weak observer reference suitable for storage inside custom observables.
WgpuExternalTextureContext
Cloneable access to the renderer-owned WGPU device and queue.
WgpuExternalTextureRegistry
Shared registry for app-owned textures sampled by SUI’s normal image draw path.
WgpuRenderer
WidgetChildren
WidgetDiagnostic
One opt-in diagnostic value published by a widget for live inspection.
WidgetDiagnosticsCtx
Collector passed to Widget::diagnostics.
WidgetDiagnosticsSnapshot
On-demand widget-specific state included in an inspector snapshot.
WidgetGeometrySnapshot
WidgetGraphSnapshot
WidgetId
WidgetNodeSnapshot
WidgetPod
Standard retained-widget adapter used by the SUI runtime.
WidgetRebuildSample
WindowBuilder
WindowCursorState
Desired host cursor state for one runtime window.
WindowId
Identifies a host render/input target.
WindowInspectorSnapshot
Renderer-neutral, point-in-time state consumed by testing tools and live inspector UIs. Capturing widget-specific diagnostics is opt-in and happens only while this snapshot is requested.
WindowOutputDiagnostics
WindowPerformanceSnapshot
WindowPerformanceSummary
WindowRenderOptions

Enums§

AccessibilityIssueSeverity
AccessibilityIssueTarget
AdaptiveClass
Constraint-derived presentation class for adaptive workspace layouts.
Alignment
AnimationEditorCommand
AnimationProperty
AnimationValue
AnimationValueKind
AspectRatioFit
Axis
Brush
BrushPreviewShape
ButtonAppearance
The visual treatment used by pressable controls.
CanvasGridStyle
CanvasRulerAxis
CanvasShape
CanvasZoomBehavior
ChoiceAppearance
The whole-row visual treatment used by checkbox, switch, and radio controls.
CollectionAnchorGravity
CollectionChange
Incremental mutation accepted by VirtualCollectionModel.
CollectionDelta
Key-only change journal consumed by virtual collection widgets.
CollectionModelError
CollectionSync
Result of asking a collection source for changes after a known revision.
ColorSpace
CommandButtonFill
CommandDelivery
CommandTarget
ConstraintOrientation
ContentExtent
Controls the child’s measured extent along a scrollable axis.
ControlSize
Contextual interface-control sizing.
CursorGrabMode
Requested host behavior for the system cursor.
DesktopAutomationAction
DockNode
One node in the persisted docking graph.
DockZone
Destination zone used when docking a panel relative to a tab group or the workspace root.
DragEventKind
DragOutcome
DragPayload
DropEffect
Easing
Event
EventPhase
EventRoutePhase
FieldAppearance
Whether an editor paints its own field chrome.
FileDialogMode
FlexAlignContent
FlexBasis
FlexJustify
FlexWrap
FocusRestorePolicy
FontStretch
Font width (the standard nine CSS font-stretch keywords / OS/2 width classes).
FontStyle
Font slant.
FramePhase
GridTrack
GridTrackMax
HairlineEdge
HdrThemeMode
IconGlyph
ImageFit
ImeEvent
InvalidationKind
InvalidationTarget
KeyState
LoopMode
MasterDetailRoute
NotificationUrgency
Overflow
OverlayAlignment
OverlayDismissReason
OverlayInitialFocus
OverlayKind
Broad behavior category used by diagnostics and accessibility adapters.
OverlayModality
OverlaySide
OverlayTraceKind
PaintBoundaryMode
PathElement
PixelCanvasBlendMode
PixelCanvasBrushShape
PixelCanvasTool
PointerButton
PointerEventKind
PointerKind
PopoverAlignment
PropertyRowLayout
RegisteredImageFormat
ResponsiveSidebarMode
RichDocumentBlockKind
RichDocumentStatus
RichInlineKind
RichSyntaxTokenKind
SceneCommand
SceneStatisticsDetailMode
ScrollAlignment
ScrollAxes
ScrollDelta
SelectionClipboardBehavior
Controls whether a selectable widget writes its selection to the clipboard from implicit widget-owned routes such as Ctrl+C and accessibility Copy.
SelectionIntent
SelectionPayload
SemanticTone
SemanticsAction
SemanticsActionRequest
A concrete accessibility action requested by a platform assistive-technology provider.
SemanticsLiveRegion
SemanticsPopupKind
SemanticsRole
SemanticsValue
SideSheetPlacement
SimpleColorPickerMode
SplitExtent
SplitPaneSide
StackOrderPolicy
StemDarkening
SurfaceAppearance
SurfaceBorder
SurfaceElevation
SurfaceRole
TableColumnAlignment
TextAffinity
TextAlign
TextCommand
Standard clipboard/selection command understood by text editing widgets.
TextCoveragePolicy
TextDirection
TextFlowDirection
TextHinting
TextRenderCoveragePolicy
TextRenderHinting
TextRenderMode
TextRenderStemDarkening
TextSubpixelOrder
TextSurfaceOverlayKind
TextWrap
TextWritingMode
ThemeColorScheme
ThemeDensity
ToggleState
TooltipAlignment
TooltipPlacement
VirtualListChrome
VirtualListSelectionMode
VirtualTableRowActivationKind
VirtualTableSortDirection
WakeEvent
WidgetColorRole
WidgetEffectRole
WidgetLuminanceRole
WidgetMaterialRole
WidgetShader
WindowColorManagementMode
WindowDynamicRangeMode
WindowEvent
WindowIcon
WindowOutputColorPrimaries
WindowStemDarkening
WindowTextCoveragePolicy
WindowTextHinting
WindowTextSubpixelOrder
WindowToneMappingMode

Constants§

ANIMATION_DOCUMENT_VERSION
BUILTIN_ICON_GLYPHS
DEFAULT_SUI_LOGO_SVG
EXTERNAL_WAKE_KIND
Legacy root-event kind. Platform wakes no longer synthesize this event; use CommandSender and window/application controllers instead.
OVERLAY_DISMISS_REQUEST
Typed runtime-to-widget request used for centralized dismissal arbitration.
REACTIVE_CHANGED
Internal typed notification delivered to widgets whose observable dependencies changed.
TEXT_COMMAND
Typed command key used for target-only text command delivery.

Traits§

ClipboardBackend
Storage driver behind a Clipboard handle.
CommandController
Non-widget application service that receives commands on the UI thread. Controllers are owned by their application/window builder and are dropped automatically with that owner.
DesktopExtension
Optional integration driven alongside SUI’s desktop event loop.
FileDialogService
Interpolate
Observable
Readable value that can notify subscribers after meaningful changes.
RichSyntaxHighlighter
ThemeExtension
Marker trait for type-indexed application theme extensions.
TimelineBindingSink
VirtualCollectionSource
Architecture-neutral data source consumed by VirtualList.
Widget
WidgetPodMutVisitor
WidgetPodVisitor

Functions§

arrange_flex
clear_window_render_options
default_sui_logo_image
detail_row_height_for_value
draw_glyph
Draw an IconGlyph tinted color, centered and fit within bounds. Exposed for bespoke painters (application chrome) that draw an icon mark without composing an Icon widget; the glyph is painted directly as native SUI path geometry.
flex_layout
grid_layout
invalidation_for_animation_property
paint_action_tile
paint_aligned_text
Paint text using SUI’s shared optical baseline and horizontal alignment path.
paint_border
paint_callout
paint_canvas_grid
paint_checkbox_indicator
paint_code_lines
paint_code_panel
paint_command_button
paint_coverage_dots
paint_coverage_dots_with_config
paint_detail_row_at
paint_disclosure_button
paint_empty_state
paint_hairline
paint_icon_button
paint_leading_label_cell
paint_placement_badge
paint_placement_badge_with
paint_progress_bar
paint_rounded_panel
paint_rounded_rect
paint_section_label
paint_section_label_detail
paint_section_panel
paint_single_line_aligned_text
Paint one unwrapped line using SUI’s shared optical baseline alignment path.
paint_status_badge
paint_text_block
paint_text_cell
paint_theme_shadow
Paint the outer (drop) layers of a ThemeShadow behind a rounded-rect surface. The tighter second layer is drawn first and the wider/more-diffuse first layer on top — matching CSS box-shadow, where the first-listed shadow is topmost.
place_overlay
Place an overlay relative to an anchor while keeping it inside a viewport.
register_builtin_icon_resources
resolve_effect_role
resolve_luminance_role
resolve_material_role
resolve_semantic_color
resolve_widget_hdr_style
set_window_render_options
set_window_scene_statistics_detail_mode
show_file_dialog
Show a dialog from an async context.
validate_accessibility_snapshot
Validate a semantic snapshot using the shared accessibility contract used by inspectors, terminal rendering, and test tooling.
window_output_diagnostics
window_performance_snapshot
window_performance_summary
window_render_options
window_scene_statistics_detail_mode
wrap_text_lines
Greedy word-wrap text to max_width, using measure for run widths.

Type Aliases§

BusyIndicator
ComboBox
DataGrid
Divider
Drawer
A familiar alias for navigation-oriented side sheets.
FileDialogFuture
Modal
MultilineTextInput
PathBar
ResizablePane
Result
SharedCompiledTimeline
SpinBox