PureAdmin.Components.CheckboxList (PureAdmin v1.1.0)

Copy Markdown View Source

Checkbox list components for Pure Admin.

Provides checkbox_list/1 container, checkbox_list_item/1 for individual items, and checkbox_box/1 as a low-level checkbox building block (for tables, etc.).

Summary

Functions

Renders a low-level checkbox (input + box) without label text.

Renders a checkbox list container.

Renders a checkbox list item with label, optional description, and actions.

Functions

checkbox_box(assigns)

Renders a low-level checkbox (input + box) without label text.

Used as a building block in tables, checkbox lists, and other composite components.

Examples

<.checkbox_box id="select-row-1" checked={@row.checked} phx-click="toggle_row" phx-value-id="1" />

Attributes

  • id (:string) - Defaults to nil.
  • name (:string) - Defaults to nil.
  • value (:string) - Defaults to "true".
  • checked (:boolean) - Defaults to false.
  • disabled (:boolean) - Defaults to false.
  • is_indeterminate (:boolean) - Indeterminate/partial state (requires PureAdminCheckbox hook). Defaults to false.
  • is_x_mark (:boolean) - X mark instead of checkmark. Defaults to false.
  • size (:string) - Defaults to nil.Must be one of nil, "xs", "sm", "lg", or "xl".
  • class (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["phx-click", "phx-change", "phx-value-id"].

checkbox_list(assigns)

Renders a checkbox list container.

Examples

<.checkbox_list>
  <.checkbox_list_item id="opt1" label_text="Option 1" />
  <.checkbox_list_item id="opt2" label_text="Option 2" checked />
</.checkbox_list>

<.checkbox_list variant="bordered" layout="2col">
  ...
</.checkbox_list>

Attributes

  • variant (:string) - Defaults to nil.Must be one of nil, "compact", "bordered", or "striped".
  • layout (:string) - Defaults to nil.Must be one of nil, "inline", "grid", "2col", or "3col".
  • class (:string) - Defaults to nil.
  • Global attributes are accepted.

Slots

  • inner_block (required)

checkbox_list_item(assigns)

Renders a checkbox list item with label, optional description, and actions.

Examples

<.checkbox_list_item id="feat1" label_text="Email Notifications" description_text="Receive updates via email" />

<.checkbox_list_item id="task1" label_text="Complete proposal" checked>
  <:actions>
    <.button size="xs" variant="danger" is_icon_only>🗑</.button>
  </:actions>
</.checkbox_list_item>

Attributes

  • id (:string) (required)
  • label_text (:string) (required)
  • description_text (:string) - Defaults to nil.
  • state (:string) - Defaults to nil.Must be one of nil, "disabled", or "locked".
  • checked (:boolean) - Defaults to false.
  • disabled (:boolean) - Defaults to false.
  • class (:string) - Defaults to nil.
  • Global attributes are accepted. Supports all globals plus: ["phx-click", "phx-change", "phx-value-id"].

Slots

  • actions - Action buttons for the item.