Skip to content

Built-in Components

The built-in components are the ratatui-kit reference manual, not a replacement for the tutorials. The tutorials first walk you through state, input exclusivity, and routing. When you start building a real application and need to look up which component to use, what it owns, and what it does not own, come back here.

These components follow the same boundary: business-neutral, composable, and clear about input semantics. Components can help with layout, drawing, input layers, and common interactions, but they do not own your business data model.

Compose first

Build the interface with View, Text, Border, ScrollView, and selection components. Keep business state in page components or hooks.

Then isolate input

Search inputs and modal components create input layers internally. When active, they stop background components from continuing to handle keyboard events.

Virtualize last

Start ordinary lists with Select / MultiSelect; move to VirtualList when the dataset is large or each row is expensive to render.

ComponentPurposeContinue reading
ViewDefault layout container; splits child regions with flex-like rulesLayout and text primitives
BorderBorders, titles, and local decorationLayout and text primitives
CenterCenters child content inside a fixed regionLayout and text primitives
PositionedSpecial layout for absolute positioningLayout and text primitives
FragmentTransparent container that wraps multiple child nodes without creating an independent layout nodeLayout and text primitives
TextDisplays a single text segment, Line, Text, or stringLayout and text primitives
WrappedTextAutomatically wraps long prose and gives the measured line count back to layoutLong text, logs, prose bodies
ScrollViewScrollable content container for long prose or long panelsLocal scroll regions

WrappedText and ScrollView are the core pair for long-text experiences: the former decides content height, while the latter decides the visible viewport and scrollbars. They come from real reading scenarios, not just examples.

ComponentPurposeInput semantics
InputSingle-line input rendering and low-level editing stateLow-level component, usually driven by a higher-level component
SearchInputSearch/create input with activation key, submit, clear, and editing stateOwns input while editing is open
ModalBase modal layer, mask, positioning, and layer injectionMust share the same layer with the handler
ConfirmModalConfirm/cancel flowsWraps an exclusive input layer internally
AlertModalMessages and close keyWraps an exclusive input layer internally
ShortcutInfoModalScrollable shortcut helpWraps an exclusive input layer internally

If you only need business confirmation, a message, or shortcut help, prefer the packaged modal components. Reach for handwritten use_input_layer, use_event_handler(EventScope::Layer(...)), and Modal(layer: Some(...)) only when the modal content has its own complex interaction model.

Component or patternPurposeContinue reading
SelectOrdinary single-select listSmall to medium lists
MultiSelectOrdinary multi-select listSmall to medium multi-select
TreeSelectGeneric tree selection without file-specific semanticsGrouped, hierarchical, directory-like data
TableData-driven table with cell-grid borders, wrapping, and row/column highlightBordered/markdown tables and structured grids
VirtualListWindowed rendering for long lists with custom rowsThousands to tens of thousands of rows
Virtual Multi SelectLong-list multi-select pattern composed from VirtualList + HashSetLong-list multi-select where business code owns the selected set

Virtual Multi Select is not a separate component. It is a recommended composition pattern. This is steadier than turning every business selection variant into a built-in component: VirtualList owns only cursor movement, windowing, and visible row rendering, while your business code still owns the selection set.

ScenarioExampleVHS
Scroll containercargo run --example scrollviewdocs/tapes/scrollview.tape
Auto-wrapped prosecargo run --example wrapped_textdocs/tapes/wrapped-text.tape
Single-line inputcargo run --example inputdocs/tapes/input.tape
Search/create inputcargo run --example search_inputdocs/tapes/search-input.tape
Base modalcargo run --example modaldocs/tapes/modal.tape
Confirm modalcargo run --example confirm_modaldocs/tapes/confirm-modal.tape
Alert modalcargo run --example alert_modaldocs/tapes/alert-modal.tape
Shortcut helpcargo run --example shortcut_info_modaldocs/tapes/shortcut-info-modal.tape
Single selectcargo run --example selectdocs/tapes/select.tape
Multi selectcargo run --example multi_selectdocs/tapes/multi-select.tape
Tree selectcargo run --example tree_selectdocs/tapes/tree-select.tape
Data tablecargo run --example tabledocs/tapes/table.tape
Virtual listcargo run --example virtual_listdocs/tapes/virtual-list.tape
Virtual multi-select patterncargo run --example virtual_multi_selectdocs/tapes/virtual-multi-select.tape

When adding new built-in components later, add the example, VHS tape, and reference page together. Component behavior described in the docs must be reproducible from a real example.