LedgerUI.Components.InputGroup (LedgerUI v0.2.0)

Copy Markdown View Source

Joins inputs, addons, selects and buttons into one row with shared borders.

<.input_group>
  <.input_group_addon>R$</.input_group_addon>
  <.input name="amount" variant="plain" />
  <.input_group_addon>,00</.input_group_addon>
</.input_group>

<.input_group label="Price" size="sm" errors={["must be positive"]}>
  <.input_group_addon variant="filled">$</.input_group_addon>
  <.input name="amount" variant="plain" size="sm" state="error" />
</.input_group>

The row is a role="group" named by the caption (aria-labelledby; give each group an id when two share a label). With errors (or state="error") every border of the row turns red, and the row gets aria-invalid and an aria-describedby that points at the messages.

The group draws the shared border, so an input/1 inside it takes variant="plain".

Summary

Functions

Renders the row; label adds a caption above it, help and errors a line below.

A text or icon box at either end (or between the inputs) of an input_group.

Functions

input_group(assigns)

Renders the row; label adds a caption above it, help and errors a line below.

Attributes

  • id (:string) - Defaults to nil.
  • shape (:string) - Defaults to "rounded". Must be one of "rounded", or "pill".
  • size (:string) - Defaults to "md". Must be one of "sm", "md", or "lg".
  • variant (:string) - Defaults to "outlined". Must be one of "outlined", or "filled".
  • label (:string) - Defaults to nil.
  • label_class (:any) - Defaults to nil.
  • help (:string) - Defaults to nil.
  • errors (:list) - Defaults to [].
  • state (:string) - Defaults to nil.Must be one of nil, "", "success", or "error".
  • wrapper_class (:any) - Defaults to nil.
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

input_group_addon(assigns)

A text or icon box at either end (or between the inputs) of an input_group.

Attributes

  • variant (:string) - Defaults to "outline". Must be one of "outline", or "filled".
  • size (:string) - Defaults to "md". Must be one of "sm", "md", or "lg".
  • class (:any) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)