Skip to content

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

VariantMeaningDefault for
Length::AutoSize to contentLeaf 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 spaceContainers (VStack, HStack, Frame)

Align (cross-axis)

VariantEffect
Align::StartTop/left (default)
Align::CenterCentered
Align::EndBottom/right
Align::StretchFill available space

Justify (main-axis)

VariantEffect
Justify::StartPack toward start (default)
Justify::CenterCenter in available space
Justify::EndPack toward end
Justify::SpaceBetweenEven space between children (none at edges)
Justify::SpaceAroundEven space around each child
Justify::SpaceEvenlyEqual space between and around children

Orientation

VariantUsage
Orientation::HorizontalHorizontal divider, horizontal splitter
Orientation::VerticalVertical divider, vertical splitter

Padding

Create via conversion:

rust
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>:

rust
.padding(1)           // uniform
.padding((2, 1))      // (vertical, horizontal)
.padding((1, 2, 1, 2))  // (top, right, bottom, left)

Visual Style

BorderStyle

VariantAppearance
BorderStyle::Plain─ │ ┌ ┐ └ ┘ (default)
BorderStyle::Rounded─ │ ╭ ╮ ╰ ╯
BorderStyle::Double═ ║ ╔ ╗ ╚ ╝
BorderStyle::Thick━ ┃ ┏ ┓ ┗ ┛
BorderStyle::LightDoubleDashedDashed light border
BorderStyle::HeavyDoubleDashedDashed heavy border
BorderStyle::LightTripleDashedTriple-dashed light
BorderStyle::HeavyTripleDashedTriple-dashed heavy
BorderStyle::LightQuadrupleDashedQuadruple-dashed light
BorderStyle::HeavyQuadrupleDashedQuadruple-dashed heavy
BorderStyle::Custom { glyphs }Custom glyph set via BorderGlyphs

CaretShape

VariantDescription
CaretShape::BlockBlock cursor (█) (default - do not set explicitly)
CaretShape::BarVertical bar cursor (│)
CaretShape::UnderlineUnderline cursor (_)

ScrollbarVariant

VariantDescription
ScrollbarVariant::StandaloneSeparate column consuming content width (default)
ScrollbarVariant::IntegratedIntegrate into right border (lazygit-style)

ColorTransform

Used with Style::transform_fg(...) and Style::transform_bg(...).

VariantDescription
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 / formDescription
Color::ResetTerminal default for that attribute (ANSI reset)
Color::BackdropBackground-only surface semantic: blank areas clear foreground content but preserve the background color already beneath them
Color::TransparentOmit 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(...).

VariantDescription
TripleClickSelectionMode::LineSelect the current logical/rendered line (default)
TripleClickSelectionMode::ParagraphSelect the current paragraph bounded by blank lines

HeatmapCellMode

VariantDescription
HeatmapCellMode::BackgroundFill 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

VariantDescription
HeatmapLegendWidth::GridAlign the legend with the heatmap grid start (default)
HeatmapLegendWidth::FullLet the legend span the full inner width, including the row-label gutter

Widget Variants

ButtonVariant

VariantRendered asConstructor shortcut
ButtonVariant::Bracket[ Label ] (default)Button::new("Label")
ButtonVariant::FilledBackground-filled (no brackets)Button::filled("Label")
ButtonVariant::OutlinedBorder-only (no background)Button::outlined("Label")

CheckboxVariant

VariantCheckedUncheckedIndeterminate
CheckboxVariant::Bracket (default)[x][ ][-]
CheckboxVariant::Circle
CheckboxVariant::Box
CheckboxVariant::Custom { checked, unchecked, indeterminate }Custom strings

CheckboxState

VariantDescription
CheckboxState::UncheckedNot checked
CheckboxState::CheckedChecked
CheckboxState::IndeterminatePartial/unknown state

RadioLayout

VariantDescription
RadioLayout::VerticalStack options vertically (default)
RadioLayout::HorizontalStack options horizontally

Note: Radio uses CheckboxVariant::Circle by default (not Bracket).

ListItemRole

VariantDescription
ListItemRole::NormalRegular selectable row (default)
ListItemRole::HeaderNon-selectable section header
ListItemRole::SpacerNon-selectable blank row

ListSymbolPosition

VariantDescription
ListSymbolPosition::LeftRender the symbol in the left symbol column (default)
ListSymbolPosition::RightRender the symbol immediately after the label content

DescriptionPlacement (SearchPalette)

VariantDescription
DescriptionPlacement::Inlinelabel - description on primary line (default)
DescriptionPlacement::RightDescription in right-aligned slot on primary line
DescriptionPlacement::AboveDescription line above label
DescriptionPlacement::BelowDescription line below label

DescriptionOverflow (SearchPalette)

VariantDescription
DescriptionOverflow::TruncateKeep descriptions on one visual line and truncate with ellipsis (default)
DescriptionOverflow::WrapWrap descriptions across multiple lines for DescriptionPlacement::Above and DescriptionPlacement::Below

MultiSelectDescriptionPlacement

VariantDescription
MultiSelectDescriptionPlacement::Inlinelabel - description on primary line (default)
MultiSelectDescriptionPlacement::RightDescription in right-aligned slot on primary line
MultiSelectDescriptionPlacement::AboveDescription line above label
MultiSelectDescriptionPlacement::BelowDescription line below label

MultiSelectDescriptionOverflow

VariantDescription
MultiSelectDescriptionOverflow::TruncateKeep descriptions on one visual line and truncate with ellipsis (default)
MultiSelectDescriptionOverflow::WrapWrap descriptions across multiple lines for MultiSelectDescriptionPlacement::Above and MultiSelectDescriptionPlacement::Below

Focus & Input

FocusPolicy

VariantUsage
FocusPolicy::NoneNo focus-aware sizing (default)
FocusPolicy::Accordion(FocusAccordion { ... })Lazygit-style panel resizing

Grid track Length (.rows / .columns)

ValueEffect
Length::AutoTrack 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

FieldTypeDefaultDescription
focused_minu167Minimum height for focused child
collapsedu163Height for non-focused children
tiny_collapsedu161Height in tight-space mode
expanded_weightu162Flex weight multiplier for focused child
squash_thresholdu1628Viewport height to enter squashed mode
tiny_thresholdu1621Viewport height to enter tiny mode

TextAreaNewlineBinding

VariantEnter key behavior
TextAreaNewlineBinding::EnterEnter inserts newline (default)
TextAreaNewlineBinding::ShiftEnterShift+Enter inserts newline
TextAreaNewlineBinding::EnterOrShiftEnterBoth insert newline

KeyBinding / KeyBindings

Public shortcut binding types from tui_lipan::input. Parsing: whitespace = chord steps, comma = alternatives. See keybindings.md.

TypeDescription
KeyBindingOne shortcut or chord (FromStr, Display, matches_sequence, is_chord, step_count, canonical_lowercase)
KeyBindingsComma-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
KeyBindingParseErrorParse 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

VariantPayloadWhen
SentinelEvent::Deleted { id, sentinel }Stable id (or UNKNOWN), full TextAreaSentinel including payloadUser 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

FieldDescription
value, cursor, anchorBuffer and caret state
sentinelsParallel custom sentinel metadata
images, image_modeSame 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)

VariantDescription
TextAreaImageMode::InlineUnicode PUA sentinels embedded in text value
TextAreaImageMode::AttachmentImages in separate list; text value unchanged

Overlay & Toast

DismissPolicy

VariantDismissed by
DismissPolicy::NoneNothing (manual only)
DismissPolicy::ClickOutsideClick outside overlay (default)
DismissPolicy::ClickInsideClick inside overlay
DismissPolicy::EscapeEscape key only
DismissPolicy::ClickOutsideOrEscapeClick outside or Escape
DismissPolicy::ClickAnywhereAny click

ToastPlacement

VariantPosition
ToastPlacement::TopStartTop-left
ToastPlacement::TopCenterTop-center
ToastPlacement::TopEndTop-right
ToastPlacement::BottomStartBottom-left
ToastPlacement::BottomCenterBottom-center
ToastPlacement::BottomEndBottom-right (default)

App Configuration

ContrastPolicy

Used by App::contrast_policy(...), widget-level .contrast_policy(...) builders, and Style::contrast_policy(...) for per-style overrides.

VariantBehavior
ContrastPolicy::WcagAuto-adjust low-contrast text using WCAG 2.1 contrast (default)
ContrastPolicy::BlackOrWhiteKeep the current foreground if it already passes WCAG; otherwise snap to black or white
ContrastPolicy::ApcaAuto-adjust using APCA perceptual contrast
ContrastPolicy::OffPreserve explicit colors exactly

TaskPolicy

VariantBehavior
TaskPolicy::QueueAllRun every task sequentially
TaskPolicy::DropIfRunningIgnore new task while one with same key is running
TaskPolicy::LatestOnlyKeep only newest pending task; drop older ones

Diff View (feature diff-view)

DiffViewMode

VariantDescription
DiffViewMode::SplitSide-by-side view (default)
DiffViewMode::UnifiedUnified view

DiffViewBackend

VariantDescription
DiffViewBackend::TextAreaTextArea-backed rendering (default, editable supported)
DiffViewBackend::DocumentViewDocumentView-backed rendering (read-only optimized)

DiffPane

VariantDescription
DiffPane::LeftLeft pane in split mode
DiffPane::RightRight pane in split mode
DiffPane::UnifiedUnified pane

Utility Types

GridPos

A position in a 2D grid, used for mouse-driven selection in grid-like UIs.

rust
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.

MethodReturnsDescription
new(pos)GridSelectionCreate 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()boolCheck if anchor equals cursor
contains(row, col)boolCheck if a cell is within the selection
extract_text(lines)StringExtract 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

rust
pub struct GridSelectionEvent {
    pub selection: Option<GridSelection>,
    pub text: Option<String>,
}

Element Helpers

ExpressionDescription
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

MIT OR Apache-2.0