Corex.List (Corex v0.1.0-beta.5)

View Source

Flat selectable items for Combobox, Listbox, and Select.

Build items with Corex.List.new/1 or Corex.List.Item.new/1. Each row is a Corex.List.Item with required :label and optional :value (defaults to item-1, item-2, … when built through new/1, or list-<integer> from generate_id/0 when built only through Item.new/1), plus :to, :redirect, :new_tab, :disabled, :group, and :meta.

When the parent sets redirect, selection can navigate using each item’s :to or value as destination; per-item :redirect is :href, :patch, :navigate, or false to opt out. With redirect enabled, the client runs single-select in Zag even if the form uses multiple.

Summary

Functions

Creates a list of List.Item structs from a list of attribute maps.

Functions

new(items)

Creates a list of List.Item structs from a list of attribute maps.

For each map or keyword list, if :value is omitted, it is set to "item-<index>" (1-based), matching Corex.Content.new/1.

Raises ArgumentError if items is not a list or contains invalid items.