Corex.List.Item (Corex v0.1.0-beta.2)

View Source

One selectable row for Combobox, Listbox, or Select.

Fields

  • :label (required) — visible text
  • :id (optional) — value id; defaults generated when built through Item.new/1
  • :to (optional) — URL or path used for redirect-on-select when the parent has redirect
  • :disabled (optional)
  • :group (optional) — group id for grouped lists
  • :meta (optional) — arbitrary map
  • :redirect (optional) — :href | :patch | :navigate | false; controls navigation kind for this item when the parent has redirect

  • :new_tab (optional) — open redirect target in a new tab

Summary

Functions

Creates a single List.Item with an auto-generated ID if not provided.

Types

redirect_mode()

@type redirect_mode() :: :href | :patch | :navigate | false | nil

t()

@type t() :: %Corex.List.Item{
  disabled: boolean(),
  group: String.t() | nil,
  id: String.t(),
  label: String.t(),
  meta: map(),
  new_tab: boolean(),
  redirect: redirect_mode(),
  to: String.t() | nil
}

Functions

new(attrs)

Creates a single List.Item with an auto-generated ID if not provided.

Raises ArgumentError if attrs is not a keyword list or map.