etui/widgets/fieldset

Types

pub type Fieldset {
  Fieldset(
    title: String,
    align: FieldsetAlign,
    line_char: String,
    pad: Int,
    fg: style.Color,
    bg: style.Color,
    title_fg: style.Color,
  )
}

Constructors

Where the title sits along the rule.

pub type FieldsetAlign {
  AlignLeft
  AlignCenter
  AlignRight
}

Constructors

  • AlignLeft
  • AlignCenter
  • AlignRight

Values

pub fn fieldset_new(title: String) -> Fieldset

A left-aligned fieldset with the given title and thin rules.

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

Draw the rule into the first row of area. An empty title renders a plain rule across the full width.

pub fn with_align(fs: Fieldset, a: FieldsetAlign) -> Fieldset

Move the title along the rule. Centered titles ignore pad.

pub fn with_colors(
  fs: Fieldset,
  fg: style.Color,
  bg: style.Color,
) -> Fieldset

Colors of the rule; the background also applies to the title.

pub fn with_line_char(fs: Fieldset, c: String) -> Fieldset

Replace the rule character (e.g. "═" for a double rule).

pub fn with_pad(fs: Fieldset, p: Int) -> Fieldset

Rule chars between the screen edge and the title. Clamped to ≥ 0.

pub fn with_title_color(
  fs: Fieldset,
  fg: style.Color,
) -> Fieldset

Color of the title text (rendered bold).

✨ Search Document