etui/widgets/tabs

Types

pub type Tabs {
  Tabs(
    labels: List(String),
    active: Int,
    fg: style.Color,
    bg: style.Color,
    active_style: style.Style,
    divider: String,
    padding: Int,
  )
}

Constructors

  • Tabs(
      labels: List(String),
      active: Int,
      fg: style.Color,
      bg: style.Color,
      active_style: style.Style,
      divider: String,
      padding: Int,
    )

    Arguments

    active

    0-based index of the active tab.

    divider

    String rendered between tabs.

    padding

    Padding spaces inside each tab label.

Values

pub fn next_tab(t: Tabs) -> Tabs

Advance one tab, wrapping past the end.

pub fn prev_tab(t: Tabs) -> Tabs

Go back one tab, wrapping before the start.

pub fn render(
  buf: buffer.Buffer,
  area: geometry.Rect,
  t: Tabs,
) -> buffer.Buffer

Render the tab bar into the first row of area.

pub fn tabs_new(labels: List(String)) -> Tabs

A tab bar with bold+reverse active style and │ dividers.

pub fn with_active(t: Tabs, idx: Int) -> Tabs

Select the tab at idx. Negative indices clamp to 0.

pub fn with_active_style(t: Tabs, s: style.Style) -> Tabs

Style of the selected tab (default: bold + reverse).

pub fn with_colors(
  t: Tabs,
  fg: style.Color,
  bg: style.Color,
) -> Tabs

Colors of inactive tabs and the divider.

pub fn with_divider(t: Tabs, div: String) -> Tabs

String drawn between adjacent tabs (default "│"; use " " to hide).

pub fn with_padding(t: Tabs, p: Int) -> Tabs

Blank cells inside each tab label. Clamped to ≥ 0.

✨ Search Document