plushie/widget/button

Button widget builder.

Types

pub opaque type Button
pub type ButtonStyle {
  Primary
  Secondary
  Success
  Warning
  Danger
  TextStyle
  BackgroundStyle
  Subtle
  Custom(style_map.StyleMap)
}

Constructors

  • Primary
  • Secondary
  • Success
  • Warning
  • Danger
  • TextStyle
  • BackgroundStyle
  • Subtle
  • Reusable-design-token style: pass a StyleMap for background, text_color, border, shadow, and state overrides. Matches the pattern Elixir / Python / TypeScript / Ruby already use.

Option type for button properties.

pub type Opt {
  Style(ButtonStyle)
  Width(length.Length)
  Height(length.Length)
  Padding(padding.Padding)
  Clip(Bool)
  Disabled(Bool)
  A11y(a11y.A11y)
}

Constructors

Values

pub fn a11y(button: Button, a: a11y.A11y) -> Button

Set accessibility properties for this button.

pub fn build(button: Button) -> node.Node

Build the button into a renderable Node.

pub fn clip(button: Button, c: Bool) -> Button

Set whether child content that overflows is clipped.

pub fn disabled(button: Button, d: Bool) -> Button

Set whether the button is disabled.

pub fn height(button: Button, h: length.Length) -> Button

Set the button height.

pub fn height_animated(
  button: Button,
  animation: node.PropValue,
) -> Button

Set height to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn new(id: String, label: String) -> Button

Create a new button builder with the given ID and label.

pub fn padding(button: Button, p: padding.Padding) -> Button

Set the button padding.

pub fn padding_animated(
  button: Button,
  animation: node.PropValue,
) -> Button

Set padding to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn style(button: Button, s: ButtonStyle) -> Button

Set the button style preset.

pub fn width(button: Button, w: length.Length) -> Button

Set the button width.

pub fn width_animated(
  button: Button,
  animation: node.PropValue,
) -> Button

Set width to an animation descriptor (Transition, Spring, or Sequence). The descriptor must be pre-encoded via its module’s encode function.

pub fn with_opts(button: Button, opts: List(Opt)) -> Button

Apply a list of options to a button builder.

Search Document