A quick filter of chips where the chosen ones take the accent: one choice by default, several
with multiple.
<.pill_select field={@form[:canal]} options={["Todos", "Balcão", "Online"]} />
<.pill_select field={@form[:categorias]} multiple options={~w(Tintas Básico Ferramentas)} />
<.pill_select name="canal" value="todos" options={[
%{label: "Todos", value: "todos", count: 128},
%{label: "Balcão", value: "balcao", count: 64}
]} />Options are strings, {label, value} tuples or maps with :label, :value, :count and
:disabled. Each pill is a lu-chip button (aria-pressed) and the choice is made in the
browser by the LedgerUI.PillSelect hook; the values travel in hidden inputs (name, or
name[] with multiple, preceded by an empty one so an emptied choice still reaches the
server) that fire a bubbling input event, so the form's phx-change runs. Without a form,
on_change is pushed on each click with %{"id" => id, "value" => value} to target.
Summary
Functions
Attributes
id(:string) - Defaults tonil.name(:string) - Defaults tonil.value(:any) - Defaults tonil.field(Phoenix.HTML.FormField) - Defaults tonil.options(:list) (required)multiple(:boolean) - Defaults tofalse.label(:string) - Defaults tonil.help(:string) - Defaults tonil.errors(:list) - Defaults to[].disabled(:boolean) - Defaults tofalse.on_change(:string) - Defaults tonil.target(:any) - Defaults tonil.wrapper_class(:any) - Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["form"].