plushie/widget/checkbox

Checkbox widget builder.

Types

pub opaque type Checkbox

Custom icon for the checkbox check mark.

pub type CheckboxIcon {
  CheckboxIcon(
    code_point: String,
    size: option.Option(Float),
    line_height: option.Option(line_height.LineHeight),
    font: option.Option(font.Font),
    shaping: option.Option(shaping.Shaping),
  )
}

Constructors

Option type for checkbox properties.

pub type Opt {
  Spacing(Int)
  Width(length.Length)
  Size(Float)
  TextSize(Float)
  Font(font.Font)
  LineHeight(line_height.LineHeight)
  Shaping(shaping.Shaping)
  Wrapping(wrapping.Wrapping)
  Style(String)
  Icon(CheckboxIcon)
  Disabled(Bool)
  Required(Bool)
  Validation(validation_state.ValidationState)
  A11y(a11y.A11y)
}

Constructors

Values

pub fn a11y(cb: Checkbox, a: a11y.A11y) -> Checkbox

Set accessibility properties for this widget.

pub fn build(cb: Checkbox) -> node.Node

Build the checkbox into a renderable Node.

pub fn disabled(cb: Checkbox, d: Bool) -> Checkbox

Set whether the widget is disabled.

pub fn font(cb: Checkbox, f: font.Font) -> Checkbox

Set the font.

pub fn icon(cb: Checkbox, i: CheckboxIcon) -> Checkbox

Set a custom icon.

pub fn line_height(
  cb: Checkbox,
  lh: line_height.LineHeight,
) -> Checkbox

Set the line height.

pub fn new(
  id: String,
  label: String,
  is_toggled: Bool,
) -> Checkbox

Create a new checkbox builder.

pub fn required(cb: Checkbox, r: Bool) -> Checkbox

Mark this field as required. Flows into a11y.required.

pub fn shaping(cb: Checkbox, s: shaping.Shaping) -> Checkbox

Set the text shaping strategy.

pub fn size(cb: Checkbox, s: Float) -> Checkbox

Set the size.

pub fn spacing(cb: Checkbox, s: Int) -> Checkbox

Set the spacing between children.

pub fn style(cb: Checkbox, s: String) -> Checkbox

Set the style.

pub fn text_size(cb: Checkbox, s: Float) -> Checkbox

Set the text size in pixels.

pub fn validation(
  cb: Checkbox,
  v: validation_state.ValidationState,
) -> Checkbox

Set the form-validation state.

pub fn width(cb: Checkbox, w: length.Length) -> Checkbox

Set the width.

pub fn with_opts(cb: Checkbox, opts: List(Opt)) -> Checkbox

Apply a list of options to a checkbox builder.

pub fn wrapping(cb: Checkbox, w: wrapping.Wrapping) -> Checkbox

Set the text wrapping mode.

Search Document