Enum & Type Reference
Quick reference for all public enums and types used in widget props and API calls.
Convention: When a prop table shows a type like
ButtonVariant, look it up here.
Layout & Sizing
Length
| Variant | Meaning | Default for |
|---|---|---|
Length::Auto | Size to content | Leaf widgets (Text, Button, Input, etc.) |
Length::Px(u16) | Fixed cell count | - |
Length::Percent(u16) | Percentage of available space (clamped to 0..=100) | - |
Length::Flex(u16) | Proportional share of remaining space | Containers (VStack, HStack, Frame) |
Align (cross-axis)
| Variant | Effect |
|---|---|
Align::Start | Top/left (default) |
Align::Center | Centered |
Align::End | Bottom/right |
Align::Stretch | Fill available space |
Justify (main-axis)
| Variant | Effect |
|---|---|
Justify::Start | Pack toward start (default) |
Justify::Center | Center in available space |
Justify::End | Pack toward end |
Justify::SpaceBetween | Even space between children (none at edges) |
Justify::SpaceAround | Even space around each child |
Justify::SpaceEvenly | Equal space between and around children |
Orientation
| Variant | Usage |
|---|---|
Orientation::Horizontal | Horizontal divider, horizontal splitter |
Orientation::Vertical | Vertical divider, vertical splitter |
Padding
Create via conversion:
Padding::from(1u16) // uniform: all sides = 1
Padding::from((2u16, 1u16)) // (vertical, horizontal)
Padding::from((1u16, 2u16, 1u16, 2u16)) // (top, right, bottom, left)Or use the .padding(...) builder which accepts impl Into<Padding>:
.padding(1) // uniform
.padding((2, 1)) // (vertical, horizontal)
.padding((1, 2, 1, 2)) // (top, right, bottom, left)Visual Style
BorderStyle
| Variant | Appearance |
|---|---|
BorderStyle::Plain | ─ │ ┌ ┐ └ ┘ (default) |
BorderStyle::Rounded | ─ │ ╭ ╮ ╰ ╯ |
BorderStyle::Double | ═ ║ ╔ ╗ ╚ ╝ |
BorderStyle::Thick | ━ ┃ ┏ ┓ ┗ ┛ |
BorderStyle::LightDoubleDashed | Dashed light border |
BorderStyle::HeavyDoubleDashed | Dashed heavy border |
BorderStyle::LightTripleDashed | Triple-dashed light |
BorderStyle::HeavyTripleDashed | Triple-dashed heavy |
BorderStyle::LightQuadrupleDashed | Quadruple-dashed light |
BorderStyle::HeavyQuadrupleDashed | Quadruple-dashed heavy |
BorderStyle::Custom { glyphs } | Custom glyph set via BorderGlyphs |
CaretShape
| Variant | Description |
|---|---|
CaretShape::Block | Block cursor (█) (default - do not set explicitly) |
CaretShape::Bar | Vertical bar cursor (│) |
CaretShape::Underline | Underline cursor (_) |
ScrollbarVariant
| Variant | Description |
|---|---|
ScrollbarVariant::Standalone | Separate column consuming content width (default) |
ScrollbarVariant::Integrated | Integrate into right border (lazygit-style) |
ColorTransform
Used with Style::transform_fg(...) and Style::transform_bg(...).
| Variant | Description |
|---|---|
ColorTransform::Dim(f32) | Dim the resolved color toward black by 0.0..=1.0 |
ColorTransform::Lighten(f32) | Lighten the resolved color toward white by 0.0..=1.0 |
ColorTransform::Opacity(f32) | Blend the resolved color toward the current background; 1.0 keeps the color, 0.0 fully washes it out |
ColorTransform::OpacityToward { factor, target } | Same factor semantics as Opacity, but blend toward target instead of the backdrop |
ColorTransform::Tint(Color, f32) | Blend the resolved color toward a target color by alpha |
Color (selected variants)
Full listing: named ANSI colors, Indexed(u8), Rgb, hex / hex_u24 helpers. Highlights:
| Variant / form | Description |
|---|---|
Color::Reset | Terminal default for that attribute (ANSI reset) |
Color::Backdrop | Background-only surface semantic: blank areas clear foreground content but preserve the background color already beneath them |
Color::Transparent | Omit fg/bg when rendering so cells keep the color underneath; in Style::patch, does not override the resolved base for that channel |
TripleClickSelectionMode
Used by TextArea::triple_click_mode(...) and DocumentView::triple_click_mode(...).
| Variant | Description |
|---|---|
TripleClickSelectionMode::Line | Select the current logical/rendered line (default) |
TripleClickSelectionMode::Paragraph | Select the current paragraph bounded by blank lines |
HeatmapCellMode
| Variant | Description |
|---|---|
HeatmapCellMode::Background | Fill each cell with a background color and optional numeric text (default) |
HeatmapCellMode::Glyph(Arc<str>) | Draw a centered glyph string over a colored background tile |
HeatmapCellMode::GlyphForeground(Arc<str>) | Draw only the glyph string in the mapped color, leaving the background untouched |
HeatmapLegendWidth
| Variant | Description |
|---|---|
HeatmapLegendWidth::Grid | Align the legend with the heatmap grid start (default) |
HeatmapLegendWidth::Full | Let the legend span the full inner width, including the row-label gutter |
Widget Variants
ButtonVariant
| Variant | Rendered as | Constructor shortcut |
|---|---|---|
ButtonVariant::Bracket | [ Label ] (default) | Button::new("Label") |
ButtonVariant::Filled | Background-filled (no brackets) | Button::filled("Label") |
ButtonVariant::Outlined | Border-only (no background) | Button::outlined("Label") |
CheckboxVariant
| Variant | Checked | Unchecked | Indeterminate |
|---|---|---|---|
CheckboxVariant::Bracket (default) | [x] | [ ] | [-] |
CheckboxVariant::Circle | ◉ | ○ | ◍ |
CheckboxVariant::Box | ✓ | ☐ | ▣ |
CheckboxVariant::Custom { checked, unchecked, indeterminate } | Custom strings |
CheckboxState
| Variant | Description |
|---|---|
CheckboxState::Unchecked | Not checked |
CheckboxState::Checked | Checked |
CheckboxState::Indeterminate | Partial/unknown state |
RadioLayout
| Variant | Description |
|---|---|
RadioLayout::Vertical | Stack options vertically (default) |
RadioLayout::Horizontal | Stack options horizontally |
Note:
RadiousesCheckboxVariant::Circleby default (notBracket).
ListItemRole
| Variant | Description |
|---|---|
ListItemRole::Normal | Regular selectable row (default) |
ListItemRole::Header | Non-selectable section header |
ListItemRole::Spacer | Non-selectable blank row |
ListSymbolPosition
| Variant | Description |
|---|---|
ListSymbolPosition::Left | Render the symbol in the left symbol column (default) |
ListSymbolPosition::Right | Render the symbol immediately after the label content |
DescriptionPlacement (SearchPalette)
| Variant | Description |
|---|---|
DescriptionPlacement::Inline | label - description on primary line (default) |
DescriptionPlacement::Right | Description in right-aligned slot on primary line |
DescriptionPlacement::Above | Description line above label |
DescriptionPlacement::Below | Description line below label |
DescriptionOverflow (SearchPalette)
| Variant | Description |
|---|---|
DescriptionOverflow::Truncate | Keep descriptions on one visual line and truncate with ellipsis (default) |
DescriptionOverflow::Wrap | Wrap descriptions across multiple lines for DescriptionPlacement::Above and DescriptionPlacement::Below |
MultiSelectDescriptionPlacement
| Variant | Description |
|---|---|
MultiSelectDescriptionPlacement::Inline | label - description on primary line (default) |
MultiSelectDescriptionPlacement::Right | Description in right-aligned slot on primary line |
MultiSelectDescriptionPlacement::Above | Description line above label |
MultiSelectDescriptionPlacement::Below | Description line below label |
MultiSelectDescriptionOverflow
| Variant | Description |
|---|---|
MultiSelectDescriptionOverflow::Truncate | Keep descriptions on one visual line and truncate with ellipsis (default) |
MultiSelectDescriptionOverflow::Wrap | Wrap descriptions across multiple lines for MultiSelectDescriptionPlacement::Above and MultiSelectDescriptionPlacement::Below |
Focus & Input
FocusPolicy
| Variant | Usage |
|---|---|
FocusPolicy::None | No focus-aware sizing (default) |
FocusPolicy::Accordion(FocusAccordion { ... }) | Lazygit-style panel resizing |
Grid track Length (.rows / .columns)
| Value | Effect |
|---|---|
Length::Auto | Track sizes from content (subject to spanning rules) (default) |
Length::Px(n) | Fixed track size |
Length::Percent(n) | Resolves against the grid's inner width or height |
Length::Flex(n) | Shares remaining space along that axis with other flex tracks |
Implicit rows are added as Auto when auto-flow runs out of space.
FocusAccordion
| Field | Type | Default | Description |
|---|---|---|---|
focused_min | u16 | 7 | Minimum height for focused child |
collapsed | u16 | 3 | Height for non-focused children |
tiny_collapsed | u16 | 1 | Height in tight-space mode |
expanded_weight | u16 | 2 | Flex weight multiplier for focused child |
squash_threshold | u16 | 28 | Viewport height to enter squashed mode |
tiny_threshold | u16 | 21 | Viewport height to enter tiny mode |
TextAreaNewlineBinding
| Variant | Enter key behavior |
|---|---|
TextAreaNewlineBinding::Enter | Enter inserts newline (default) |
TextAreaNewlineBinding::ShiftEnter | Shift+Enter inserts newline |
TextAreaNewlineBinding::EnterOrShiftEnter | Both insert newline |
KeyBinding / KeyBindings
Public shortcut binding types from tui_lipan::input. Parsing: whitespace = chord steps, comma = alternatives. See keybindings.md.
| Type | Description |
|---|---|
KeyBinding | One shortcut or chord (FromStr, Display, matches_sequence, is_chord, step_count, canonical_lowercase) |
KeyBindings | Comma-separated alternatives (FromStr, Display, canonical_lowercase, iter, primary, is_empty, len) |
ChordMatcher<T> | Stateful incremental matcher for chords (feed, reset, is_pending) |
ChordResult<T> | None / Pending / Matched from ChordMatcher::feed |
KeyBindingParseError | Parse error type for invalid binding strings |
Lowercase helpers are also available:
KeyBinding::canonical_lowercase()KeyBindings::canonical_lowercase()format_binding_lowercase(...)format_bindings_lowercase(...)
SentinelId
Opaque Copy id for a custom inline sentinel. SentinelId::UNKNOWN is 0 when no id was set on a removed token. New ids are assigned by insert_sentinel (via internal SentinelId::next()).
SentinelEvent
| Variant | Payload | When |
|---|---|---|
SentinelEvent::Deleted { id, sentinel } | Stable id (or UNKNOWN), full TextAreaSentinel including payload | User edit removed the sentinel char from the buffer |
Emitted by: TextArea::on_sentinel_event (batched).
TextAreaSentinel
Builder-style struct (not an enum): new(label), style, focus_style, payload<T>(data), id(SentinelId), get_payload, sentinel_id. Equality compares label, styles, and id (payload is ignored).
TextAreaSnapshot
| Field | Description |
|---|---|
value, cursor, anchor | Buffer and caret state |
sentinels | Parallel custom sentinel metadata |
images, image_mode | Same fields as on TextArea |
Methods: TextAreaSnapshot::capture(&TextArea), apply(self, TextArea) -> TextArea, diff(&self, &Self) -> Vec<SentinelEvent> (stable ids removed between snapshots).
TextAreaImageMode (requires feature image)
| Variant | Description |
|---|---|
TextAreaImageMode::Inline | Unicode PUA sentinels embedded in text value |
TextAreaImageMode::Attachment | Images in separate list; text value unchanged |
Overlay & Toast
DismissPolicy
| Variant | Dismissed by |
|---|---|
DismissPolicy::None | Nothing (manual only) |
DismissPolicy::ClickOutside | Click outside overlay (default) |
DismissPolicy::ClickInside | Click inside overlay |
DismissPolicy::Escape | Escape key only |
DismissPolicy::ClickOutsideOrEscape | Click outside or Escape |
DismissPolicy::ClickAnywhere | Any click |
ToastPlacement
| Variant | Position |
|---|---|
ToastPlacement::TopStart | Top-left |
ToastPlacement::TopCenter | Top-center |
ToastPlacement::TopEnd | Top-right |
ToastPlacement::BottomStart | Bottom-left |
ToastPlacement::BottomCenter | Bottom-center |
ToastPlacement::BottomEnd | Bottom-right (default) |
App Configuration
ContrastPolicy
Used by App::contrast_policy(...), widget-level .contrast_policy(...) builders, and Style::contrast_policy(...) for per-style overrides.
| Variant | Behavior |
|---|---|
ContrastPolicy::Wcag | Auto-adjust low-contrast text using WCAG 2.1 contrast (default) |
ContrastPolicy::BlackOrWhite | Keep the current foreground if it already passes WCAG; otherwise snap to black or white |
ContrastPolicy::Apca | Auto-adjust using APCA perceptual contrast |
ContrastPolicy::Off | Preserve explicit colors exactly |
TaskPolicy
| Variant | Behavior |
|---|---|
TaskPolicy::QueueAll | Run every task sequentially |
TaskPolicy::DropIfRunning | Ignore new task while one with same key is running |
TaskPolicy::LatestOnly | Keep only newest pending task; drop older ones |
Diff View (feature diff-view)
DiffViewMode
| Variant | Description |
|---|---|
DiffViewMode::Split | Side-by-side view (default) |
DiffViewMode::Unified | Unified view |
DiffViewBackend
| Variant | Description |
|---|---|
DiffViewBackend::TextArea | TextArea-backed rendering (default, editable supported) |
DiffViewBackend::DocumentView | DocumentView-backed rendering (read-only optimized) |
DiffPane
| Variant | Description |
|---|---|
DiffPane::Left | Left pane in split mode |
DiffPane::Right | Right pane in split mode |
DiffPane::Unified | Unified pane |
Utility Types
GridPos
A position in a 2D grid, used for mouse-driven selection in grid-like UIs.
pub struct GridPos {
pub row: usize, // Zero-based row index
pub col: usize, // Zero-based column index
}GridSelection
A 2D range selection with anchor (start) and cursor (current) positions.
| Method | Returns | Description |
|---|---|---|
new(pos) | GridSelection | Create a new single-point selection |
extend_to(pos) | - | Extend selection to a new cursor position |
normalized() | (GridPos, GridPos) | Get ordered (start, end) where start <= end |
is_empty() | bool | Check if anchor equals cursor |
contains(row, col) | bool | Check if a cell is within the selection |
extract_text(lines) | String | Extract selected text from a slice of line strings |
columns_for_row(row, line_width) | Option<(usize, usize)> | Get selected column range for a row (for rendering) |
GridSelectionEvent
pub struct GridSelectionEvent {
pub selection: Option<GridSelection>,
pub text: Option<String>,
}Element Helpers
| Expression | Description |
|---|---|
Element::empty() | Empty placeholder (use in if/else branches) |
widget.into() | Convert any widget into Element |
widget.key("my-key") | Assign stable identity for reconciliation/focus |