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§
- Accessibility
Issue - Accessibility
Snapshot - Action
Card - Action
Tile Paint - Adaptive
Breakpoints - Width thresholds used by adaptive widgets.
- Adaptive
View - Retains one subtree per presentation class and switches between them based on the space allocated by the parent.
- Align
- Animated
Value - Animation
Binding - Animation
Binding Invalidation - Animation
Document - Animation
Document Format Error - Animation
Editor State - Animation
Player - Animation
Property Path - Animation
Selection - Animation
Target Id - Animation
Tick - Application
- Lower-level application builder for runtime and platform integration.
- Arrange
Ctx - Aspect
Ratio - Constrains one retained child to an aspect ratio without specializing it as an image or media widget.
- Async
Task Inspector Snapshot - Async
Wake Token - Background
- Basic
Syntax Highlighter - Lightweight dependency-free lexer used by the default code-block renderer.
- Blink
- Border
- Bottom
Sheet - A modal surface anchored to the bottom edge of its allocated viewport.
- Breadcrumb
- Breadcrumb
Item - Browser
TabBar - Brush
Preview - Brush
Preview Spec - Button
- Cache
Metrics - Cache
Metrics Delta - Callout
Paint - Canvas
- Canvas
Ruler - Canvas
Stroke - Canvas
Viewport - Checkbox
- Checkbox
Indicator State - Clip
- Clipboard
- Shared handle to the clipboard service.
- Code
Panel Paint - Code
Text Line - Code
Text Paint - Code
Text Span - Collection
Anchor - Collection
Extent Index - Variable-height prefix-sum index used by virtual collection policies.
- Collection
Window - Describes the loaded slice of a potentially larger collection.
- Color
- Color
Palette - Color
Palette Swatch - Color
Picker - Color
Swatch - Command
- Borrowed view of a command while it is delivered on the UI thread.
- Command
Button Paint - Command
Ctx - Context supplied to window and application command controllers.
- Command
Dispatch Sample - One application-command delivery attempt retained in the next frame.
- Command
Group - Command
Key - A process-local, strongly typed command identifier.
- Command
Palette - Modal presentation shell for application command search and execution.
- Command
Sender - Cloneable, thread-safe producer for application commands.
- Compiled
Clip - Compiled
Timeline - Compiled
Track - Constraint
Query - Serializable, locally evaluated container query.
- Constraint
View - Retains each declarative query branch and visits only the first matching one.
- Constraints
- Context
Menu - Control
Metrics - Control
Palette - Control
Typography - Coverage
Dots - Coverage
Dots Config - Custom
Event - Date
Time Input - 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. - Default
Theme - Desktop
Automation Config - Desktop
Platform - Detail
Row - Dialog
- Dirty
Region - Disclosure
Button Paint - Dock
- Vertical dock layout with optional fixed-height top and bottom slots.
- Dock
Panel - DpiInfo
- Drag
Drop Host - Drag
Drop Scope - Drag
Event - Drag
Preview - Drag
Scope Id - Drag
Session Id - Draggable
- Drop
Target - Effect
Token - Embedded
SvgImage Resource - Empty
State - Empty
State Paint - Error
- Event
Ctx - Event
Route Step - Event
Route Trace Sample - Privacy-safe event routing trace. Event payloads and typed characters are intentionally not retained.
- Field
Group - File
Dialog Filter - File
Dialog Request - File
Dialog Selection - Fixed
Pane Split - Flex
- Flex
Item - Flex
Item Layout - Flex
Layout - Flex
Line Layout - Flex
Style - Floating
Stack - Floating
View Config - Floating
View Snapshot - Floating
Workspace - Floating
Workspace State - Focus
Scope - Retains focus history for a stable child subtree.
- Focus
Scope State - Shared retained focus history for a
FocusScope. - Focus
State - Font
Family Stack - An ordered, theme-owned font-family preference list.
- Font
Feature - A single OpenType feature setting: a 4-byte tag plus a value (
0disables,1enables, and larger values select an alternate/parameter for features that take one). - Font
Features - An ordered collection of OpenType feature settings applied to a text run. Later settings for the same tag take precedence in the shaper.
- Font
Handle - Font
Registry - Font
Weight - OpenType weight axis value. Conventional named weights span 100..=900; for variable fonts any
value in the font’s
wghtrange is valid. - FormRow
- Form
Section - Frame
Phase Sample - Frame
Schedule - Framed
Field - A reusable field frame for compound editors such as search/composer rows.
- Gradient
Stop - Grid
- Retained explicit grid container backed by the renderer-independent
sui-layouttrack solver. - Grid
Cell - Grid
Item - Grid
Item Layout - Grid
Layout - Grid
Placement - Grid
Style - HdrColor
Roles - HdrEffect
Tokens - HdrLuminance
Tokens - HdrMaterial
Tokens - HdrPolicy
Tokens - HdrTheme
Tokens - Headless
Platform - Icon
- Icon
Button - Icon
Button Paint - Image
- Image
Handle - Image
Registry - Image
Source - Insets
- Inspector
History Snapshot - Intrinsic
Size - Minimum and preferred content extents reported by a widget along one axis.
- Invalidation
Request - Invalidation
Trace Sample - The origin and optional caller explanation for a scheduled invalidation.
- Keyboard
Event - Keyed
Children - Layout-neutral retained child collection reconciled by stable application keys.
- Keyed
Reconcile - Keyframe
- Keyframe
Selection - Label
- Layer
List - Layer
List Item - Layer
List Reorder Change - Layout
Context - Layout
Transition - Animates a retained subtree from its previous arranged origin to its new origin while layout itself immediately settles at the destination.
- Leading
Label Cell Paint - Link
- List
Item - List
View - Local
Clipboard Backend - In-process clipboard storage used when no platform backend is installed.
- Master
Detail - Shows master and detail side-by-side when space permits, and converts to a focus-restoring navigation stack under compact constraints.
- Master
Detail State - Cloneable navigation state shared by a master-detail layout and the app.
- Material
Token - Measure
Ctx - Measured
Bottom Dock - Vertical dock layout where the bottom child is measured to its natural height.
- Menu
- Menu
Item - Modifiers
- Motion
Scalar - Native
File Dialogs - Notification
Center - Thread-safe producer for transient, window-hosted notifications.
- Notification
Host - Window-level visual and semantic host for a
NotificationCenter. - Notification
Id - Number
Input - Observable
Change - Metadata emitted when an observable value changes.
- Observer
- Cloneable change observer used by observable implementations.
- Overlay
Collision Policy - Overlay
Dismiss Policy - Overlay
Dismiss Request - Overlay
Focus Behavior - Focus behavior shared by every transient presentation policy.
- Overlay
Host - Defines an independent overlay stacking root.
- Overlay
Manager Snapshot - Overlay
Options - Runtime behavior declared by the logical owner of an overlay.
- Overlay
Placement - Overlay
Placement Request - Overlay
Placement Result - Overlay
Snapshot - Overlay
Trace Sample - Padding
- Paint
Ctx - Panel
Section - Password
Input - A single-line text input that masks its visible value while retaining the
same selection, clipboard, IME, and change-callback behavior as
TextInput. - Path
- Path
Builder - Persistent
Text Layout - Pixel
Canvas - Pixel
Canvas Export Snapshot - Pixel
Canvas State - Placement
Badge - Placement
Badge Paint - Platform
File - Platform
Window - Playback
State - Point
- Pointer
Buttons - Pointer
Event - Popover
- Presentation
Latency Diagnostics - Preset
Strip - Progress
Bar - Property
Row - Pulse
- Radio
Button - Radio
Group - Reactive
Invalidation Sample - Rebuild
OnChange - Hosts a child subtree that is rebuilt whenever a caller-supplied key changes.
- Rebuild
OnConstraints - Hosts a child subtree that is rebuilt whenever layout constraints resolve to a new key.
- Rect
- Registered
External Image - Renderer-neutral metadata for an image whose pixels are owned outside the frame’s CPU image registry.
- Registered
Font - Registered
Image - Render
Diagnostics - Render
Output - Renderer
Capabilities - Renderer
Interop - Renderer
Submission Diagnostics - Reorderable
List - Reorderable
List Change - Resolved
Effect Style - Resolved
HdrStyle - Resolved
Material Style - Resolved
Text Face - Responsive
Sidebar - A stable sidebar/content layout that becomes an overlay drawer in compact constraints and a collapsible rail or inline pane in wider constraints.
- Responsive
Sidebar Snapshot - Responsive
Sidebar State - Cloneable application-owned state for a responsive sidebar.
- Retained
Packet Rebuild Diagnostics - Rich
Attachment - Rich
Block Id - Stable identity for a block in a
RichDocumentModel. - Rich
Document Block - Rich
Document Model - Rich
Document Render Context - Context passed to an application-defined rich-document block renderer.
- Rich
Document Renderer Registry - Registry of block renderers keyed by architecture-neutral names.
- Rich
Document Snapshot - Rich
Document Span - Rich
Document Update - Rich
Document View - Retained, selectable, incrementally updating rich-document widget.
- Rich
Document View State - Shareable retained state for a
RichDocumentView. - Rich
Extension Block - Application-defined structured block rendered through a registry entry.
- Rich
Inline Image - Rich
Inline Style - Rich
Link - Rich
List Item - Rich
Syntax Span - Rich
Text - Rich
Text Source Map - Original source plus the mapping needed to copy source-preserving rich-text selections.
- Rich
Text Source Span - Maps byte ranges in rendered rich text back to the original source.
- Runtime
- Runtime
Application - Safe
Area - Insets one retained child by the current window’s safe area.
- Safe
Area Edges - Selects which edges of
SafeAreaconsume the platform-provided insets. - Safe
Area Insets - Sample
Batch - Sample
Buffer - Sampled
Animation Value - Scene
- Scene
Frame - Scene
Statistics - Scheduler
Inspector Snapshot - Scroll
Bar - Scroll
State - Scroll
View - Section
Label - Section
Label Paint - Section
Panel Geometry - Section
Panel Paint - Segmented
Control - Segmented
Control Item - Select
- Selection
Change - Selection
Entry - Selection
Order - Selection
Owner Id - Selection
Point - Selection
Scope - Selector
- Equality-deduplicated derived observable.
- Semantic
Color Token - Semantic
Region - Semantics
Ctx - Semantics
Event - An assistive-technology action directed at a semantic node.
- Semantics
Node - Semantics
Relations - Semantics
State - Semantics
Text Range - Separator
- Shadow
Params - Shaped
Glyph - Shaped
Text - Shaped
Text Window - Sheet
State - Cloneable presentation state shared by a sheet and application controls.
- Side
Sheet - An overlay panel anchored to a viewport edge.
- Signal
- Cloneable observable storage with equality-deduplicated writes.
- Signal
Meter - Simple
Color Picker - Single
Child - Size
- Sized
Box - Slider
- Source
Id - Stable identity for one observable source.
- Spinner
- Split
State - Cloneable, observable split-pane state.
- Split
State Snapshot - Split
View - Spring
F32 - Stack
- Stack
Host Options - Stack
Surface Options - Status
Badge - Status
Bar - Status
BarHost - Status
BarSegment - Stroke
Style - Style
- Minimal shared style values for custom facade-level components.
- Subscription
- Keeps an observable subscription alive.
- Surface
- Surface
Id - Surface
Palette - Switch
- Switch
View - TabBar
- Table
- Table
Column - Table
Row - Tabs
- Text
Area - Text
Block Paint - Text
Cache Delta Diagnostics - Text
Cache Diagnostics - Text
Cell Paint - Text
Cluster - Text
Cursor - Text
Document - Text
Glyph Instance - Text
Input - Text
Layout - Text
Layout Handle - Text
Layout Id - Text
Layout Metadata - Text
Layout Registry - Text
Layout Request - Text
Layout Run - Text
Layout Version - Text
Layout View - Text
Line - Text
Line Window - Text
Measurement - Text
Paragraph - Text
Paragraph Layout - Text
Paragraph Style - Text
Render Policy - TextRun
- Text
RunView - Text
Selection - Text
Selection Geometry - Text
Selection Info - Text
Span - Text
Span Id - Text
Style - Text
Surface - Text
Surface Style Overlay - Text
Surface Style Span - Theme
- Application-level colors, built-in widget theme, and custom extensions.
- Theme
Aspect Ratios - Theme
Blur Scale - Theme
Breakpoints - Theme
Colors - Theme
Containers - Theme
Extensions - Type-indexed storage for application-specific theme values.
- Theme
Font Families - Theme
Font Stack - Theme
Font Weights - Theme
Leading - Theme
Motion - Motion design tokens: a shared vocabulary of animation durations and easing curves so widgets and applications animate consistently.
- Theme
Perspective - Theme
Radii - Theme
Shadow - Theme
Shadow Layer - Theme
Shadows - Theme
Text Scale - Theme
Text Token - Theme
Tracking - Timeline
- Timeline
Player - Timeline
Snap - Timeline
Tick - Timer
Inspector Snapshot - Timer
Token - Tool
Palette - Tool
Palette Item - Toolbar
- Tooltip
- Track
- Trailing
Slot Row - Transform
- Transient
Notification - Transition
- Tree
Item - Tree
View - Vector
- Virtual
Collection Model - Cloneable observable collection with stable keys and incremental changes.
- Virtual
List - Data-backed retained virtual list with stable keyed row identity.
- Virtual
List State - Virtual
Scroll View - Virtual
Table - Virtual
Table Column - Virtual
Table RowContext - Virtual
Table State - Retained interaction state shared by rebuilt
VirtualTableinstances. - Virtual
Viewport Snapshot - Observable projection of a virtual collection viewport.
- Waker
- A cheap, cloneable,
Sendhandle that wakes the running desktop UI from any thread. Pendingwakecalls are coalesced into one event-loop signal. This is a scheduler primitive: it does not synthesize or route a widget event. - Weak
Observer - Weak observer reference suitable for storage inside custom observables.
- Wgpu
External Texture Context - Cloneable access to the renderer-owned WGPU device and queue.
- Wgpu
External Texture Registry - Shared registry for app-owned textures sampled by SUI’s normal image draw path.
- Wgpu
Renderer - Widget
Children - Widget
Diagnostic - One opt-in diagnostic value published by a widget for live inspection.
- Widget
Diagnostics Ctx - Collector passed to
Widget::diagnostics. - Widget
Diagnostics Snapshot - On-demand widget-specific state included in an inspector snapshot.
- Widget
Geometry Snapshot - Widget
Graph Snapshot - Widget
Id - Widget
Node Snapshot - Widget
Pod - Standard retained-widget adapter used by the SUI runtime.
- Widget
Rebuild Sample - Window
Builder - Window
Id - Identifies a host render/input target.
- Window
Inspector Snapshot - 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.
- Window
Output Diagnostics - Window
Performance Snapshot - Window
Performance Summary - Window
Render Options
Enums§
- Accessibility
Issue Severity - Accessibility
Issue Target - Adaptive
Class - Constraint-derived presentation class for adaptive workspace layouts.
- Alignment
- Animation
Editor Command - Animation
Property - Animation
Value - Animation
Value Kind - Aspect
Ratio Fit - Axis
- Brush
- Brush
Preview Shape - Button
Appearance - The visual treatment used by pressable controls.
- Canvas
Ruler Axis - Canvas
Shape - Choice
Appearance - The whole-row visual treatment used by checkbox, switch, and radio controls.
- Collection
Anchor Gravity - Collection
Change - Incremental mutation accepted by
VirtualCollectionModel. - Collection
Delta - Key-only change journal consumed by virtual collection widgets.
- Collection
Model Error - Collection
Sync - Result of asking a collection source for changes after a known revision.
- Color
Space - Command
Button Fill - Command
Delivery - Command
Target - Constraint
Orientation - Content
Extent - Controls the child’s measured extent along a scrollable axis.
- Control
Size - Contextual interface-control sizing.
- Desktop
Automation Action - Drag
Event Kind - Drag
Outcome - Drag
Payload - Drop
Effect - Easing
- Event
- Event
Phase - Event
Route Phase - Field
Appearance - Whether an editor paints its own field chrome.
- File
Dialog Mode - Flex
Align Content - Flex
Basis - Flex
Justify - Flex
Wrap - Focus
Restore Policy - Font
Stretch - Font width (the standard nine CSS
font-stretchkeywords / OS/2 width classes). - Font
Style - Font slant.
- Frame
Phase - Grid
Track - Grid
Track Max - Hairline
Edge - HdrTheme
Mode - Icon
Glyph - Image
Fit - ImeEvent
- Invalidation
Kind - Invalidation
Target - KeyState
- Loop
Mode - Master
Detail Route - Notification
Urgency - Overflow
- Overlay
Alignment - Overlay
Dismiss Reason - Overlay
Initial Focus - Overlay
Kind - Broad behavior category used by diagnostics and accessibility adapters.
- Overlay
Modality - Overlay
Side - Overlay
Trace Kind - Path
Element - Pixel
Canvas Blend Mode - Pixel
Canvas Brush Shape - Pixel
Canvas Tool - Pointer
Button - Pointer
Event Kind - Pointer
Kind - Popover
Alignment - Property
RowLayout - Registered
Image Format - Responsive
Sidebar Mode - Rich
Document Block Kind - Rich
Document Status - Rich
Inline Kind - Rich
Syntax Token Kind - Scene
Command - Scene
Statistics Detail Mode - Scroll
Alignment - Scroll
Axes - Scroll
Delta - Selection
Clipboard Behavior - Controls whether a selectable widget writes its selection to the clipboard from implicit widget-owned routes such as Ctrl+C and accessibility Copy.
- Selection
Intent - Selection
Payload - Semantic
Tone - Semantics
Action - Semantics
Action Request - A concrete accessibility action requested by a platform assistive-technology provider.
- Semantics
Live Region - Semantics
Popup Kind - Semantics
Role - Semantics
Value - Side
Sheet Placement - Simple
Color Picker Mode - Split
Extent - Split
Pane Side - Stack
Order Policy - Stem
Darkening - Surface
Appearance - Surface
Border - Surface
Elevation - Surface
Role - Table
Column Alignment - Text
Affinity - Text
Align - Text
Command - Standard clipboard/selection command understood by text editing widgets.
- Text
Coverage Policy - Text
Direction - Text
Flow Direction - Text
Hinting - Text
Render Coverage Policy - Text
Render Hinting - Text
Render Mode - Text
Render Stem Darkening - Text
Subpixel Order - Text
Surface Overlay Kind - Text
Wrap - Text
Writing Mode - Theme
Color Scheme - Theme
Density - Toggle
State - Tooltip
Alignment - Tooltip
Placement - Virtual
List Chrome - Virtual
List Selection Mode - Virtual
Table RowActivation Kind - Virtual
Table Sort Direction - Wake
Event - Widget
Color Role - Widget
Effect Role - Widget
Luminance Role - Widget
Material Role - Widget
Shader - Window
Color Management Mode - Window
Dynamic Range Mode - Window
Event - Window
Icon - Window
Output Color Primaries - Window
Stem Darkening - Window
Text Coverage Policy - Window
Text Hinting - Window
Text Subpixel Order - Window
Tone Mapping Mode
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
CommandSenderand 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§
- Clipboard
Backend - Storage driver behind a
Clipboardhandle. - Command
Controller - 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.
- File
Dialog Service - Interpolate
- Observable
- Readable value that can notify subscribers after meaningful changes.
- Rich
Syntax Highlighter - Theme
Extension - Marker trait for type-indexed application theme extensions.
- Timeline
Binding Sink - Virtual
Collection Source - Architecture-neutral data source consumed by
VirtualList. - Widget
- Widget
PodMut Visitor - Widget
PodVisitor
Functions§
- arrange_
flex - clear_
window_ render_ options - default_
sui_ logo_ image - detail_
row_ height_ for_ value - draw_
glyph - Draw an
IconGlyphtintedcolor, centered and fit withinbounds. Exposed for bespoke painters (application chrome) that draw an icon mark without composing anIconwidget; 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_
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
ThemeShadowbehind a rounded-rect surface. The tightersecondlayer is drawn first and the wider/more-diffusefirstlayer on top — matching CSSbox-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 - 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
texttomax_width, usingmeasurefor run widths.
Type Aliases§
- Busy
Indicator - Combo
Box - Data
Grid - Divider
- Drawer
- A familiar alias for navigation-oriented side sheets.
- File
Dialog Future - Modal
- Multiline
Text Input - PathBar
- Resizable
Pane - Result
- Shared
Compiled Timeline - SpinBox