Expand description
High level UI primitives built on top of the Compose core runtime.
Re-exports§
pub use text_field_focus::has_focused_field;pub use layout::measure_layout;pub use layout::tree_needs_layout;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::SemanticsAction;pub use layout::SemanticsCallback;pub use layout::SemanticsNode;pub use layout::SemanticsRole;pub use layout::SemanticsTree;pub use primitives::BasicTextField;pub use primitives::BasicTextFieldOptions;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::Column;pub use primitives::ColumnSpec;pub use primitives::ForEach;pub use primitives::Layout;pub use primitives::Row;pub use primitives::RowSpec;pub use primitives::Spacer;pub use primitives::SubcomposeLayout;pub use primitives::Text;pub use scroll::ScrollElement;pub use scroll::ScrollNode;pub use scroll::ScrollState;pub use widgets::lazy_list::LazyColumn;pub use widgets::lazy_list::LazyColumnSpec;pub use widgets::lazy_list::LazyRow;pub use widgets::lazy_list::LazyRowSpec;
Modules§
- fling_
animation - Fling animation driver for scroll containers.
- layout
- scroll
- Scroll state and node implementation for cranpose.
- text_
field_ focus - Global focus manager for text fields.
- text_
layout_ result - Text layout result with cached glyph positions.
- widgets
- UI Widget components
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.
- Clickable
Element - Element that creates and updates clickable nodes.
- Clickable
Node - 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
- 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
Manager - Focus manager that tracks and manages focus state across the composition.
- Graphics
Layer - Headless
Renderer - A lightweight renderer that walks the layout tree and materialises paint commands.
- KeyEvent
- A keyboard input event.
- Layout
Node - 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. Modifiers form a persistent tree structure (via CombinedModifier pattern) to enable O(1) composition and structural sharing during recomposition.
- Modifier
Chain Trace Guard - RAII guard returned when installing a modifier chain trace subscriber.
- Modifier
Node Slices - Snapshot of modifier node slices that impact draw and pointer subsystems.
- Modifiers
- Modifier keys state.
- 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.
- Placement
- Placement information for a measured child.
- Point
- Pointer
Event - Pointer event with consumption tracking for gesture disambiguation.
- Pointer
Input Scope - Recorded
Render Scene - A collection of render operations for a composed scene.
- Rect
- Resolved
Background - Resolved
Modifiers - Rounded
Corner Shape - Size
- Size
Element - Element that creates and updates size nodes.
- Size
Node - Node that enforces size constraints on its content.
- Snapshot
State - Subcompose
Layout Node - Node responsible for orchestrating measure-time subcomposition.
- Subcompose
Measure Scope Impl - Concrete implementation of
SubcomposeMeasureScope. - Text
Field Element - Element that creates and updates
TextFieldModifierNodeinstances. - Text
Field Modifier Node - Modifier node for editable text fields.
- Text
Metrics - Text
Modifier Element - Element that creates and updates TextModifierNode instances.
- Text
Modifier Node - Node that stores text content and handles measurement, drawing, and semantics.
Enums§
- Brush
- Draw
Command - Fill
Direction - Direction for fill modifiers (horizontal, vertical, or both).
- Horizontal
Alignment - Alignment along the horizontal axis.
- 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.
- Linear
Arrangement - Arrangement strategy matching Jetpack Compose’s linear arrangements.
- Paint
Layer - Layer that a paint operation targets within the rendering pipeline.
- Pointer
Event Kind - Render
Op - A rendered operation emitted by the headless renderer stub.
- Vertical
Alignment - Alignment along the vertical axis.
Traits§
- Arrangement
- Trait implemented by arrangement strategies that distribute children on an axis.
- Measurable
- Object capable of measuring a layout child and exposing intrinsic sizes.
- Placeable
- Result of running a measurement pass for a single child.
- Subcompose
Layout Scope - Base trait for measurement scopes.
- Subcompose
Measure Scope - Public trait exposed to measure policies for subcomposition.
- Text
Measurer
Functions§
- active_
focus_ target - Returns the currently active focus target, if any.
- clear_
focus_ invalidations - Clears all pending focus invalidations without processing them.
- clear_
pointer_ repasses - Clears all pending pointer repasses without processing them.
- collect_
modifier_ slices - Collects modifier node slices directly from a reconciled
ModifierNodeChain. - collect_
slices_ from_ modifier - Collects modifier node slices by instantiating a temporary node chain from a
Modifier. - current_
density - Returns the current density scale factor (logical px per dp).
- 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
- get_
cursor_ x_ for_ offset - Returns x position for given byte offset. Used for cursor rendering and selection geometry.
- get_
offset_ for_ position - Returns byte offset in text for given x position. Used for cursor positioning on click.
- has_
pending_ draw_ repasses - Returns true if any draw repasses are pending.
- has_
pending_ focus_ invalidations - Returns true if any focus invalidations are pending.
- has_
pending_ layout_ repasses - Returns true if any layout repasses are pending.
- has_
pending_ pointer_ repasses - Returns true if any pointer repasses 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.
- layout_
text - Computes full text layout with cached glyph positions. Returns TextLayoutResult for O(1) position lookups.
- log_
layout_ tree - Logs the current layout tree to stdout 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 to stdout showing all draw operations
- log_
screen_ summary - Logs a compact summary of what’s on screen (counts by type)
- measure_
text - next_
cursor_ blink_ time - Returns the next cursor blink transition time, if any.
Use this for
WaitUntilscheduling in the event loop. - peek_
focus_ invalidation - Returns true if a focus invalidation is pending without clearing it.
- peek_
layout_ invalidation - Returns true if a layout invalidation is pending without clearing it.
- peek_
pointer_ invalidation - Returns true if a pointer invalidation is pending without clearing it.
- peek_
render_ invalidation - Returns true if a render invalidation is pending without clearing it.
- process_
focus_ invalidations - Processes all pending focus invalidations.
- process_
pointer_ repasses - Processes all pending pointer repasses.
- request_
focus_ invalidation - Requests a focus recomposition without affecting layout/draw dirties.
- request_
layout_ invalidation - Requests a global layout re-run.
- request_
pointer_ invalidation - Requests a new pointer-input pass without touching layout or draw dirties.
- request_
render_ invalidation - Requests that the renderer rebuild the current scene.
- 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.
- run_
test_ composition - Build a composition with a simple in-memory applier and run the provided closure once.
- schedule_
draw_ repass - Schedules a draw-only repass for a specific node.
- schedule_
focus_ invalidation - Schedules a focus invalidation for the specified node.
- schedule_
layout_ repass - Schedules a layout repass for a specific node.
- schedule_
pointer_ repass - Schedules a pointer repass for the specified node.
- set_
active_ focus_ target - Sets the currently active focus target.
- set_
density - Updates the current density scale factor.
- set_
text_ measurer - start_
cursor_ blink - Starts the global cursor blink animation. Called when a text field gains focus.
- stop_
cursor_ blink - Stops the global cursor blink animation. Called when no text field is focused.
- take_
draw_ repass_ nodes - Takes all pending draw repass node IDs.
- take_
focus_ invalidation - Returns true if a focus invalidation was pending and clears the flag.
- take_
layout_ invalidation - Returns true if a layout invalidation was pending and clears the flag.
- take_
layout_ repass_ nodes - Takes all pending layout repass node IDs.
- take_
pointer_ invalidation - Returns true if a pointer invalidation was pending and clears the flag.
- take_
render_ invalidation - Returns true if a render invalidation was pending and clears the flag.
- tick_
cursor_ blink - Advances the cursor blink state if needed.
Returns
trueif a redraw is needed.
Type Aliases§
- Key
- Test
Composition - Convenience alias used in examples and tests.