Expand description
High level UI primitives built on top of the Compose core runtime.
Re-exports§
pub use bring_into_view::BringIntoViewResponder;pub use bring_into_view::local_bring_into_view_responder;pub use bring_into_view::scroll_delta_to_reveal;pub use density::Density;pub use density::DensityMeasureScope;pub use density::density;pub use density::local_density;pub use draggable::DragDeltaHandler;pub use draggable::DraggableState;pub use draggable::rememberDraggableState;pub use focus_manager::FocusManager;pub use focus_manager::local_focus_manager;pub use focus_manager::request_focus_from_platform;pub use focus_order::FocusEntry;pub use focus_order::collect_focus_order;pub use focus_order::focus_order_len;pub use focus_order::set_focus_order;pub use font_scale::FontScaleCurve;pub use font_scale::MAX_FONT_SCALE_KNOTS;pub use layout::LayoutAllocationDebugStats;pub use layout::LayoutBox;pub use layout::LayoutEngine;pub use layout::LayoutMeasurements;pub use layout::LayoutNodeData;pub use layout::LayoutNodeKind;pub use layout::LayoutTree;pub use layout::MeasureLayoutOptions;pub use layout::SemanticsAction;pub use layout::SemanticsCallback;pub use layout::SemanticsNode;pub use layout::SemanticsRole;pub use layout::SemanticsTree;pub use layout::build_layout_tree_from_applier;pub use layout::build_semantics_tree_from_applier;pub use layout::build_semantics_tree_from_layout_tree;pub use layout::measure_layout;pub use layout::measure_layout_with_options;pub use layout::tree_needs_layout;pub use layout::tree_needs_semantics;pub use layout_direction::LayoutDirection;pub use layout_direction::ProvideLayoutDirection;pub use layout_direction::layout_direction;pub use layout_direction::local_layout_direction;pub use lazy_item::ProvideLazyItemKey;pub use lazy_item::lazy_item_key;pub use lazy_item::local_lazy_item_key;pub use modal::ModalRegistration;pub use modal::clear_modals;pub use modal::dispatch_modal_back;pub use modal::local_modal_depth;pub use modal::modal_depth;pub use nine_patch::NinePatchInsets;pub use nine_patch::PatchFill;pub use nine_patch::PatchQuad;pub use nine_patch::nine_patch_quads;pub use nine_patch::tile_count;pub use nine_patch::tile_quads;pub use primitives::AnimatedVisibility;pub use primitives::BasicText;pub use primitives::BasicTextField;pub use primitives::BasicTextFieldDecorated;pub use primitives::BasicTextFieldDecorationScope;pub use primitives::BasicTextFieldOptions;pub use primitives::BasicTextFieldWithOptions;pub use primitives::BasicTextWithOptions;pub use primitives::BitmapPainter;pub use primitives::BitmapRegionPainter;pub use primitives::Box;pub use primitives::BoxScope;pub use primitives::BoxSpec;pub use primitives::BoxWithConstraints;pub use primitives::BoxWithConstraintsScope;pub use primitives::BoxWithConstraintsScopeImpl;pub use primitives::Button;pub use primitives::ButtonSpec;pub use primitives::Canvas;pub use primitives::Column;pub use primitives::ColumnSpec;pub use primitives::ContentScale;pub use primitives::Crossfade;pub use primitives::DEFAULT_ALPHA;pub use primitives::EnterTransition;pub use primitives::ExitTransition;pub use primitives::ForEach;pub use primitives::Image;pub use primitives::Layout;pub use primitives::Painter;pub use primitives::Row;pub use primitives::RowSpec;pub use primitives::Spacer;pub use primitives::SubcomposeLayout;pub use primitives::SvgPainter;pub use primitives::SvgPainterError;pub use primitives::Text;pub use primitives::TextWithOptions;pub use primitives::fade_in;pub use primitives::fade_out;pub use primitives::rememberSvg;pub use primitives::slide_in_vertically;pub use primitives::slide_out_vertically;pub use safe_area::WindowInsets;pub use safe_area::local_ime_insets;pub use safe_area::local_safe_area_insets;pub use safe_area::window_insets;pub use scroll::ScrollElement;pub use scroll::ScrollMetrics;pub use scroll::ScrollNode;pub use scroll::ScrollSettlePolicy;pub use scroll::ScrollState;pub use scrollbar::ThumbBounds;pub use scrollbar::ThumbGeometry;pub use scrollbar::content_delta_for_thumb_drag;pub use scrollbar::thumb_geometry;pub use text::LinkAnnotation;pub use text::ParagraphStyle;pub use text::PlatformParagraphStyle;pub use text::PlatformSpanStyle;pub use text::PlatformTextStyle;pub use text::PreparedTextLayout;pub use text::SpanStyle;pub use text::StringAnnotation;pub use text::TextDrawStyle;pub use text::TextLayoutOptions;pub use text::TextLayoutResult;pub use text::TextLinePrefixWidths;pub use text::TextMeasurer;pub use text::TextMetrics;pub use text::TextOptions;pub use text::TextOverflow;pub use text::TextShaping;pub use text::TextStyle;pub use text::get_cursor_x_for_offset;pub use text::get_offset_for_position;pub use text::layout_text;pub use text::measure_text;pub use text::measure_text_for_node;pub use text::measure_text_with_options;pub use text::measure_text_with_options_for_node;pub use text::prepare_text_layout;pub use text::prepare_text_layout_for_node;pub use text::set_text_measurer;pub use text_field_focus::ImeEditorState;pub use text_field_focus::has_focused_field;pub use text_input_session::PlatformTextInputHandler;pub use widgets::clickable_text::ClickableText;pub use widgets::lazy_list::LazyColumn;pub use widgets::lazy_list::LazyColumnSpec;pub use widgets::lazy_list::LazyRow;pub use widgets::lazy_list::LazyRowSpec;pub use widgets::linked_text::LinkedText;pub use widgets::popup::dismiss_top_popup;pub use widgets::popup::dismissable_popup_open;pub use widgets::slider::Slider;pub use widgets::slider::SliderOrientation;pub use widgets::slider::SliderScope;pub use widgets::slider::SliderSpec;pub use widgets::swipe_to_dismiss::SwipeDismissDirection;pub use widgets::swipe_to_dismiss::SwipeDismissSide;pub use widgets::swipe_to_dismiss::SwipeDismissState;pub use widgets::swipe_to_dismiss::SwipeToDismiss;pub use widgets::swipe_to_dismiss::SwipeToDismissBox;pub use widgets::swipe_to_dismiss::SwipeToDismissSpec;pub use widgets::swipe_to_dismiss::rememberSwipeDismissState;pub use widgets::text_selection_menu::local_on_light_surface;pub use zoom::ZoomState;
Modules§
- announce
- bring_
into_ view - Bring-a-focused-field’s-caret-into-view above the soft keyboard.
- clipboard_
session - Platform clipboard session: an OS clipboard read/write bridge for in-tree UI.
- density
- Integral layout, the way Compose does it.
- draggable
- General drag state, for controls that are dragged but do not scroll.
- fling_
animation - Fling animation driver for scroll containers.
- focus_
manager - focus_
order - font_
scale - The system font-size setting, as the curve it is and not the multiplier it looks like.
- layout
- layout_
direction - Which way the interface reads.
- lazy_
item - The identity of the lazy-list item currently being composed.
- modal
- The stack of modal surfaces that are open right now.
- nine_
patch - Filling a box with an image that is bigger, or smaller, than the box.
- round_
scaling_ list - Placing list rows the way a round watch scales them.
- round_
scroll_ indicator - The curved scroll indicator a round watch puts at 3 o’clock.
- safe_
area - Platform safe-area insets exposed to composition.
- scroll
- Scroll state and node implementation for cranpose.
- scrollbar
- Where a scrollbar’s thumb sits and how long it is.
- text
- text_
field_ focus - Focus manager for text fields.
- text_
input_ session - Platform text-input session: soft-keyboard visibility hooks.
- text_
layout_ result - Text layout result with cached glyph positions.
- text_
selection - Native-grade text selection primitives for
BasicTextField. - widgets
- UI Widget components
- zoom
- Pinch-to-zoom / pan state and the
Modifier::zoomablegesture modifier.
Macros§
- remember
Scroll State - Creates a remembered ScrollState.
Structs§
- Alignment
- Alignment across both axes used for positioning content within a box.
- Alpha
Element - Element that creates and updates alpha nodes.
- Alpha
Node - Node that applies alpha transparency to its content.
- Background
Element - Element that creates and updates background nodes.
- Background
Node - Node that draws a background behind its content.
- Blurred
Edge Treatment - Controls blur behavior outside source bounds.
- Canvas
Semantics Node - A semantics node for content that is drawn rather than laid out.
- Clickable
Element - Element that creates and updates clickable nodes.
- Clickable
Node - Collection
Info - How far a container has scrolled along one axis and how far it can go.
- Color
- Composition
- Constraints
- Constraints used during layout measurement.
- Corner
Radii - Corner
Shape Element - Element that creates and updates corner shape nodes.
- Corner
Shape Node - Node that tracks the latest rounded corner shape.
- Dp
- Density-independent pixels: a layout length that reads the same on every device regardless of its pixel density.
- DpOffset
- Density-independent offset for shadows.
- Draw
Cache Builder - Edge
Insets - Padding values for each edge of a rectangle.
- Fill
Element - Element that creates and updates fill nodes.
- Fill
Node - Node that fills the maximum available space in one or both dimensions.
- Focus
Requester - A handle an app holds to move focus onto a node imperatively.
- Fractional
Offset Element - Element that creates and updates fractional offset nodes.
- Fractional
Offset Node - Node that offsets its content by a fraction of its own measured size.
- Glass
Material - Visual parameters for
Modifier::glass_material. - Graphics
Layer - Headless
Renderer - A lightweight renderer that walks the layout tree and materialises paint commands.
- Image
Bitmap - Immutable RGBA image data used by UI primitives and render backends.
- KeyEvent
- A keyboard input event.
- Layout
Node - Lazy
Items - A run of lazy items: how many, and optionally how they are identified and reused.
- Lazy
List Item Info - Information about a single visible item in a lazy list.
- Lazy
List Layout Info - Information about the currently visible items in a lazy list.
- Lazy
List State - State object for lazy list scroll position tracking.
- Measure
Result - Result of a measurement operation.
- Modifier
- A modifier chain that can be applied to composable elements.
- Modifier
Chain Trace Guard - RAII guard returned when installing a modifier chain trace subscriber.
- Modifier
Local Key - Type-safe key referencing a modifier local value.
- Modifier
Local Read Scope - Lightweight read scope surfaced to modifier local consumers.
- Modifier
Node Slices - Snapshot of modifier node slices that impact draw and pointer subsystems.
- Modifier
Node Slices Debug Stats - Modifiers
- Keyboard modifier keys held during an input sample.
- Mutable
Interaction Source - Node
Capabilities - Capability flags indicating which specialized traits a modifier node implements.
- Node
State - Runtime state tracked for every
ModifierNode. - Offset
Element - Element that creates and updates offset nodes.
- Offset
Node - Node that offsets its content by a fixed (x, y) amount.
- Padding
Element - Element that creates and updates padding nodes.
- Padding
Node - Node that adds padding around its content.
- Placeable
- Result of running a measurement pass for a single child.
- Placement
- Placement information for a measured child.
- Point
- Pointer
Event - Pointer event with consumption tracking for gesture disambiguation.
- Pointer
Input Scope - Press
Interaction Cancel - Press
Interaction Press - Press
Interaction Release - Progress
BarRange Info - The value a control holds inside a range, for a slider, a dial or a progress bar.
- Recorded
Render Scene - A collection of render operations for a composed scene.
- Rect
- Resolved
Background - Resolved
Modifiers - Rotary
Input Modifier Node - Modifier node that forwards rotary scroll events to an app handler.
- Rotary
Scroll Event - A rotary scroll event produced by a Wear OS crown or rotating bezel.
- Rounded
Corner Shape - Runtime
Shader - A custom WGSL shader effect, analogous to Android’s
RuntimeShader. - Scroll
Axis Range - This is Compose’s
ScrollAxisRange(verticalScrollAxisRange,horizontalScrollAxisRange). A lazy list has no whole extent to give, so it reports the first visible item as the value and one more than that as the end while it can still scroll; a reader only needs to know whether it can page on. - Semantics
Configuration - Semantics configuration for accessibility.
- Semantics
Custom Action - A screen-reader action that is not a click, e.g. Compose’s
customActions = listOf(CustomAccessibilityAction("Pause") { … }). - Semantics
Requester - A handle an app holds to say that what its semantics recorder would report has changed.
- Semantics
Scroll By - What a container does when a screen reader pages it, e.g. TalkBack’s scroll forward action or an accesskit scroll down. The two deltas are in layout pixels; the answer says whether anything moved.
- Semantics
SetProgress - What a control does when a screen reader moves its value, e.g. a VoiceOver swipe up or a TalkBack set-progress action.
- Semantics
SetText - What a text field does when a screen reader or a voice tool hands it new
text. This is Compose’s
SemanticsActions.SetText; the answer says whether the field took the text. - Shadow
- Static shadow configuration.
- Shadow
Scope - Pixel-space shadow scope used by block-based APIs.
- Size
- Size
Element - Element that creates and updates size nodes.
- Size
Node - Node that enforces size constraints on its content.
- Snapshot
State - Cheap copyable mutable view of a state cell.
- Subcompose
Layout Node - Node responsible for orchestrating measure-time subcomposition.
- Subcompose
Measure Scope Impl - Concrete implementation of
SubcomposeMeasureScope. - Test
Applier Guard - Test
Composition - In-memory composition helper used by tests.
- Text
Field Buffer - A mutable text buffer that can be edited.
- Text
Field Element - Element that creates and updates
TextFieldModifierNodeinstances. - Text
Field Modifier Node - Text
Field State - Observable state holder for text field content.
- Text
Field Value - Immutable snapshot of text field content.
- Text
Modifier Element - Element that creates and updates TextModifierNode instances.
- Text
Modifier Node - Node that stores text content and handles measurement, drawing, and semantics.
- Text
Range - Represents a range in text, used for cursor position and selection.
- Transform
Origin
Enums§
- Blend
Mode - Blend mode used for draw primitives.
- Brush
- Color
Filter - Simple image color filter model.
- Compositing
Strategy - Draw
Command - Fill
Direction - Direction for fill modifiers (horizontal, vertical, or both).
- Focus
Direction - Focus direction for navigation.
- Focus
Request Error - Why
FocusRequester::request_focuscould not move focus. - Horizontal
Alignment - Alignment along the horizontal axis.
- Image
Sampling - Texture sampling mode for image primitives.
- Interaction
- Intrinsic
Size - Specifies how to size a component based on its intrinsic measurements.
- KeyCode
- Physical key codes for keyboard input.
- KeyEvent
Type - Type of keyboard event.
- Layer
Shape - Linear
Arrangement - Arrangement strategy matching Jetpack Compose’s linear arrangements.
- Live
Region Mode - How urgently a screen reader reads a node whose text changed on its own.
- Paint
Layer - Layer that a paint operation targets within the rendering pipeline.
- Pointer
Event Kind - Pointer
Source - The kind of physical device that produced a pointer event.
- Press
Interaction - Render
Effect - A render effect applied to a graphics layer’s rendered content.
- Render
Op - A rendered operation emitted by the headless renderer.
- Semantics
Widget Role - What kind of control a node is, as screen readers announce it.
- Text
Field Line Limits - Line limit configuration for text fields.
- Vertical
Alignment - Alignment along the vertical axis.
Constants§
- MAX_
FONT_ SCALE - Largest system font scale honoured. Android’s own accessibility slider tops out at 2.0.
- MIN_
FONT_ SCALE - Smallest system font scale honoured; below this, text stops being readable as text.
Traits§
- Arrangement
- Trait implemented by arrangement strategies that distribute children on an axis.
- Delegatable
Node - Provides traversal helpers that mirror Jetpack Compose’s
DelegatableNodecontract. - Lazy
List Scope - Receiver scope for lazy list content definition.
- Measurable
- Object capable of measuring a layout child and exposing intrinsic sizes.
- Modifier
Node - Core trait implemented by modifier nodes.
- Modifier
Node Element - Strongly typed modifier elements that can create and update nodes while exposing equality/hash/inspector contracts that mirror Jetpack Compose.
- Subcompose
Layout Scope - Base trait for measurement scopes.
- Subcompose
Measure Scope - Public trait exposed to measure policies for subcomposition.
Functions§
- active_
focus_ target - Returns the currently active focus target, if any.
- clean_
slot_ skip_ count - Number of subcompose measure passes on this thread that reused a retained
slot without a compose walk. Diagnostic surface for tests and telemetry;
see
SubcomposeMeasureScope::subcomposefor when a slot may skip. - clear_
focus_ invalidations - Clears all pending focus invalidations without processing them.
- collect_
is_ pressed_ as_ state - Free-function form of
MutableInteractionSource::collectIsPressedAsState. - collect_
modifier_ slices - Collects modifier node slices directly from a reconciled
ModifierNodeChain. - collect_
semantics_ from_ modifier - Collects semantics by instantiating a temporary modifier chain from a
Modifier. - collect_
slices_ from_ modifier - Collects modifier node slices by instantiating a temporary node chain from a
Modifier. - command_
draw_ scope - The scope every framework-run draw command records into: sized by the consumer, measuring text with the app’s fonts.
- command_
draw_ scope_ reusing command_draw_scoperecording into storage the consumer already owns — the retained-recorder path where a command’s buffer keeps its capacity across frames.- current_
density - Returns the current density scale factor (logical px per dp).
- current_
font_ scale - Returns the system font scale — the multiplier the user chose in the
platform’s font-size setting,
1.0when they left it alone. - current_
font_ scale_ curve - Returns the conversion the platform performs for a size in
Sp. - execute_
draw_ commands - format_
layout_ tree - Returns a formatted string representation of the layout tree
- format_
modifier_ chain - Formats the modifier chain using inspector data.
- format_
render_ scene - Returns a formatted string representation of the render scene
- format_
screen_ summary - Returns a compact summary of what’s on screen (counts by type).
- has_
pending_ focus_ invalidations - Returns true if any focus invalidations are pending.
- install_
modifier_ chain_ trace - Installs a callback that receives modifier chain snapshots when debugging is enabled.
- is_
cursor_ visible - Returns whether the cursor should be visible right now.
- last_
fling_ velocity - log_
layout_ tree - Logs the current layout tree through the logger with indentation showing hierarchy.
- log_
modifier_ chain - Logs the contents of a modifier node chain including capabilities.
- log_
render_ scene - Logs the current render scene through the logger.
- log_
screen_ summary - Logs a compact summary of what’s on screen (counts by type).
- next_
cursor_ blink_ time - Returns the next cursor blink transition time, if any.
Use this for
WaitUntilscheduling in the event loop. - process_
focus_ invalidations - Processes all pending focus invalidations.
- remember
Lazy List State - Creates a remembered
LazyListStatewith default initial position. - remember
Lazy List State With Position - Creates a remembered
LazyListStatewith the specified initial position. - remember
Mutable Interaction Source - reset_
cursor_ blink - Resets cursor to visible and restarts the blink timer. Call this on any input (key press, paste) so cursor stays visible while typing.
- reset_
last_ fling_ velocity - run_
test_ composition - Build a composition with a simple in-memory applier and run the provided closure once.
- scale_
sp - A size in scale-independent pixels, in dp, through the running app’s curve.
- schedule_
focus_ invalidation - Schedules a focus invalidation for the specified node.
- set_
active_ focus_ target - Sets the currently active focus target.
- set_
density - Updates the current density scale factor.
- set_
font_ scale - Updates the system font scale, taking it as a plain multiplier.
- set_
font_ scale_ curve - Updates the system font scale and the conversion behind it.
- start_
cursor_ blink - Starts the active context’s cursor blink animation. Called when a text field gains focus.
- stop_
cursor_ blink - Stops the active context’s cursor blink animation. Called when no text field is focused.
- tick_
cursor_ blink - Advances the cursor blink state if needed.
Returns
trueif a redraw is needed. A transition schedules a scoped draw repass on the focused field, so the caller only has to run the ordinary dirty-node paths — no whole-scene work.
Type Aliases§
- Draw
Command Fn - A draw command records into a scope the CONSUMER provides, instead of returning a freshly allocated primitive vector. This is the boundary that lets recording storage live with the command’s stable identity and be reused frame over frame (the retained draw-command recorder), rather than being reallocated, moved, and dropped on every execution.
- Key
- Text
PanResolver - Resolver that recomputes (and stores) the horizontal pan offset for a text field given the current content viewport width in px.