API index
Exported types and method groups with direct links to their contracts.
Crate-root exports
| Types / functions | Contract |
|---|---|
run, run_with_options, App, Frame, RunOptions, RunError | Desktop runner |
Context, EventResponse, InputState, InputStats | Context below, Input, Custom host |
KeyInterest, KeyEvent | Keys a focused widget owns and the events it receives: Keys for a widget, Custom widgets |
FocusGroup, FocusGroupOutput, FocusAxis | One Tab stop and arrow-key navigation for several controls: Focus groups |
Diagnostic, DiagnosticKind, DebugOverlay | Diagnostics |
Id | IDs and retained state |
Ui, Widget, Response, Sense | Ui below, Components, Input, Custom widgets |
Field, Validation, SemanticStatus | Field and validation |
Dock, DockState, DockNode, DockChild, DockFloat, PanelId, DockViewer, DockOutput, DockPanelOutput, DockEvent, DockSide, DockDropZone, DockStyle, DockPreset, DockMotion, DockActions, DockError, DockIssue | IDE panel workspace |
Window | Panel builders and geometry |
Grid, GridUi, GridRow, GridStyle, GridOutput, Column, ColumnWidth, Align | Shared column layout |
Table, TableBody, TableStyle, TableOutput, SortRequest, SortDirection | Data table composition |
ScrollArea, ScrollAreaOutput, ScrollStyle | Scroll viewports and virtualization |
PanZoom, PanZoomState, PanZoomOutput, ZoomWheel | Application camera and local content |
Popup, PopupOutput, MAX_POPUP_DEPTH | Overlay layers and dismissal |
Modal, ModalOutput, ModalAnchor, ModalStyle, CloseReason, Dialog, DialogAction, DialogOutput, Confirm, Confirmation | Modal dialogs, confirmations and sheets |
ComboBox, ComboBoxOption, ComboBoxStyle | Selection and filtering |
Tooltip, TooltipWidget, ContextMenu, ContextMenuWidget | Tooltip, ContextMenu |
Text | Text builders and fonts |
TextEdit | Single-line editing and IME |
Button | Button builders and activation |
Checkbox | Boolean binding |
Switch | Animated on/off binding |
DragSource, DropTarget, DragOutput, DropOutput, Dropped, DragEnd, DragReason, DragStyle, DropZones, Insertion | Typed in-window drag and drop |
Slider, SliderStatus | Numeric binding |
ColorPicker, ColorPickerType | Color selection |
Separator | Dividing lines |
Style | Theme fields and defaults |
Animation, Interpolate, Easing, Decay, DecayOptions, Oklab, Path, PathFollow, PathPose, Tween, TweenOptions, Keyframes, Keyframe, Repeat, Procedural, Wake | Animation tracks and extension contracts |
Animated, AnimationStatus, AnimationSample, AnimationOptions, MotionStyle | Animation state, scheduling and style |
Layout, Padding | Layout and insets |
Rect, RectShape, Shape, Border, CornerRadius, Color | Drawing, Color |
DrawData, GeometryUpdate, DrawCommand, Vertex, TextureId, TextureImage | Drawing protocol |
Material, MaterialId, MaterialPaint, MaterialError, MaterialErrorKind, ParamKind, ParamLayout, ParamValue, Params, MaterialDraw, MaterialSource, MAX_MATERIALS, MAX_UNIFORM_BYTES, MAX_PARAM_BYTES, FRAME_BYTES | Materials |
Renderer, RenderError, RenderStatus, PresentationMode | Renderer |
EmbeddedRenderer, EmbedOptions, EmbedAlpha, EmbedColorSpace, EmbedViewport, EmbedLoad, PhysicalRect, RecordReport, EmbedError | Embedding in a wgpu host |
CacheStats, RendererStats | Performance counters |
Vec2, vec2 | glam two-dimensional vectors |
winit, wgpu | Integration-crate re-exports |
Context
One context holds UI state for one native viewport.
| Method | Returns / purpose |
|---|---|
Context::new() / default() | Bundled font and default style |
Context::with_font(FontArc) | Custom single-weight font context |
Context::with_fonts(FontFamily) | Custom family with a file per weight; see Text and fonts |
run(build: impl FnOnce(&mut Context)) | bool, currently always true; complete UI pass |
run_at(Instant, build), frame_time(), needs_repaint_at(Instant) | Deterministic monotonic host clock |
transition, transition_from, animate, animate_with | Retained visible animation channels |
sample_animation, animation_status, pause_animation, resume_animation, cancel_animation, finish_animation, restart_animation, restart_animation_with | Animation sampling and controls |
transition_smooth | Velocity-preserving property transition |
set_animation_rate, reverse_animation, seek_animation, animation_elapsed, animation_rate, animation_duration | Playback rate, direction and scrubbing |
on_window_event(&WindowEvent) | EventResponse; process native input immediately (converts with InputEvent::from_window_event and calls on_input) |
on_input(InputEvent) | EventResponse; the one input entry point, with no window or event loop: PointerMoved, Button, Wheel, Key, Modifiers, Ime, Focus, Resized, ScaleFactor, file drop; see Input |
on_key_event(KeyCode, ElementState, bool) | EventResponse; physical key bridge, with repeat flag; text/modifiers supplied separately; the event's logical key is unidentified |
sync_ime(&Window) | Enable and position native IME after a custom host UI pass |
ime_cursor_area() | Optional logical composition window anchor |
request_focus(Id), close_popup(), close_popup_branch() | Move widget focus; close the leaf popup, or the whole branch of nested popups, and restore focus |
diagnostics(), set_diagnostic_handler(..), set_debug_overlay(DebugOverlay), debug_overlay() | Usage diagnostics and the debug overlay |
on_text_event(&str) | EventResponse; committed text bridge for TextEdit and editable color fields |
input() | &InputState; read accumulated input during the callback (idle outside an open modal) |
cursor_icon() | Native winit::window::CursorIcon for the hovered/captured region; applied automatically by the runner |
style() / set_style(Style) | &Style / replace style and request repaint |
set_viewport(PhysicalSize<u32>, f64) | Set physical size and DPI; request repaint on change |
viewport() | Rect in logical coordinates |
scale_factor() | f32 physical pixels per logical pixel |
draw_data() | &DrawData from the most recent completed pass |
request_repaint() | Schedule another pass |
request_repaint_after(Duration) | Record the earliest future deadline |
needs_repaint() | bool; pending immediate request or elapsed deadline |
next_repaint() | Option<Instant> |
wants_animation_frame() | Continuous visible motion; Vsync hosts request the next presented frame |
cache_stats() | CacheStats snapshot |
input_stats() | InputStats: key claims, events waiting, held keys owned, events dropped, focus groups and members; bounded counters for profiling and tests |
set_viewport substitutes 1 for a nonpositive or nonfinite input scale. Use ordinary
finite positive DPI values; renderable logical viewport and scale are validated by
the renderer. Context exposes no public per-widget hit registration, mesh painting,
or retained-window reset API.
Ui
Created by Window::show; construction fields are private.
| Method | Returns / purpose |
|---|---|
add(impl Widget) | Response; apply automatic follow-up repaint |
interact(Rect, impl Hash, Sense) | Response for custom geometry through the shared hit path; see Custom widgets |
keys(&Response, KeyInterest) | Vec<KeyEvent>; own these keys while the widget has focus and take its events (claim_keys declares, take_keys takes) |
focus_entry(&Response) | Inside a FocusGroup: the item Tab lands on from outside |
add_enabled_ui(bool, build) | Closure result; the one way to disable a group (.enabled(bool) for one control) |
add_enabled(bool, impl Widget) | Deprecated; use add_enabled_ui or .enabled |
is_enabled() | bool; effective enabled state |
label(text) | Response; add Text |
text_edit(&mut String) | Response; add a single-line editor |
muted(text) | Response; add text in Style::muted_text |
heading(text), title(text), small(text), typography(role, text) | Response; text at the theme's type scale |
tooltip(Response, text) | Attach a hint to a built response; widget.tooltip(text) does it in one expression |
context_menu(Response, &items) | ContextMenuOutput; widget.context_menu(&items) does it in one expression |
button(text) | Response; add Button |
button_enabled(bool, text) | Deprecated; Button::new(text).enabled(bool) |
selectable(bool, text) | Response; selected button appearance |
selectable_value(&mut T, T, text) | Response; update selection and report changed() |
tab_bar(&mut T, (T, label) iterator) | Vec<Response>; tabs bound to a selection, scrolling horizontally when they do not fit |
tab_pages(source, usize, Vec2, build) | Fixed-size directed page transitions, latest pending selection |
animation_id, transition, transition_from, animate, animate_with | Scoped application animation channels |
checkbox(&mut bool, text) | Response; add Checkbox |
checkbox_enabled(bool, &mut bool, text) | Deprecated; Checkbox::new(..).enabled(bool) |
switch(&mut bool, text) | Response; add Switch |
switch_enabled(bool, &mut bool, text) | Deprecated; Switch::new(..).enabled(bool) |
drag_source(Id, payload, build) | DragOutput<R>; make content draggable |
drop_target(Id, accept, build) | DropOutput<R, P>; accept payloads of type P |
dragging(), keep_drag_source(Id) | Active source id; keep a virtualized source alive |
slider(&mut T, RangeInclusive<T>) | Response; add Slider for f32 or any Numeric |
slider_enabled(bool, &mut T, range) | Deprecated; Slider::new(..).enabled(bool) |
slider_labeled(&mut T, range, text) | Response; caption and value below track |
combo_box_values(&mut T, (T, label) iterator) | Response; combo box bound to a value, ids from the values |
color_picker(&mut Color, text) | Response; expandable internal color editor |
separator() | Response; add horizontal Separator |
horizontal(build) | Closure result; nest a horizontal row |
grid(source, columns, build) | GridOutput<R>; shared columns with stable row keys |
vertical(build) | Closure result; nest a vertical column, including inside a row |
push_id(impl Hash, build) | Closure result; scope child IDs |
style() | &Style |
context() | &mut Context |
available_width() | f32; remaining logical width |
clip_rect() | Rect; logical content clip |
add_space(f32) | Advance layout cursor |
allocate_space(Vec2) | Rect; reserve custom geometry |
paint(impl Into<Shape>) | Add cached vector shape or RectShape builder |
Widget::ui(self, &mut Ui<'_>) -> Response consumes the widget. Widget::tooltip(text)
and Widget::context_menu(&items) wrap any widget. Response is Copy; geometry and
hover/press/focus fields are public and events (clicked, double_clicked,
secondary_clicked, drag_started, dragged, drag_delta, drag_stopped,
gained_focus, lost_focus, changed, submitted, menu_selected) are methods, see
Input. Use Ui::add to preserve automatic repaint behavior for
custom widgets.
Public modules
| Module | Contents |
|---|---|
app | Desktop runner types and functions |
components | Components, Ui, Widget, Response, Style; per-component submodules |
context | Context, Id, input and CPU cache counters |
layout | Layout, Padding |
protocol | Frame, vertex, command, texture protocol |
renderer | GPU renderer, errors, statuses, presentation, GPU counters |
shapes | Drawing primitives; compatibility re-exports of four protocol types |
widgets | Compatibility re-export of all components |
The internal text engine and context/renderer implementation submodules are private. Generate compiler-linked API documentation locally with:
cargo doc --no-deps --openScroll containers also expose Ui::scroll_vertical, Ui::scroll_to_rect,
Ui::scroll_to_response, and Ui::available_height. See ScrollArea.
Dock
Ui::dock(&mut DockState, viewer) and Dock::new(id_source, &mut state) build
application-owned panel trees. Builder options: style, size, name, actions
and show. See Dock for model operations, output,
floating windows and the versioned save / load format.