Tags: clickable badges that represent an attribute, a filter or an action.
<.tag href="#">Default</.tag>
<.tag navigate={~p"/tags/elixir"} color="primary" shape="pill">Elixir</.tag>
<.tag color="info" variant="bordered" shape="pill" phx-click="filter">Info</.tag>
<.tag variant="soft" active={tag in @selected} phx-click="toggle" phx-value-tag={tag}>{tag}</.tag>
<.tag_group>
<.tag color="neutral">Primary</.tag>
<.tag color="primary">55</.tag>
</.tag_group>With href, navigate or patch a tag is a link; otherwise a button. as="span" (or
static) renders a non-interactive <span>. removable draws the x of a removable tag
(give on_remove to make it act). With canvas the tag is the canvas lu-tag: an optional
colour swatch and a remove button.
Summary
Functions
Attributes
color(:string) - Defaults to"neutral". Must be one of"neutral","primary","secondary","info","success","warning","error", or"light".variant(:string) - Defaults to"solid". Must be one of"solid","soft","bordered","outline", or"flat".tint(:string) - A CSS colour of its own; overridescolor. Defaults tonil.active(:boolean) - Selected state of a filter chip. Defaults tofalse.count(:integer) - A small pill with this number after the label. Defaults tonil.shape(:string) - Defaults to"rounded". Must be one of"rounded","pill", or"square".as(:string) - Defaults tonil.Must be one ofnil, or"span".static(:boolean) - Defaults tofalse.type(:string) - Defaults to"button".removable(:boolean) - Draws thexof a removable tag. Defaults tofalse.on_remove(:any) - An event name orJScommand for thex. Defaults tonil.remove_label(:string) - Defaults to"Remover".canvas(:boolean) - The canvaslu-tag(swatch + remove button). Defaults tofalse.swatch(:string) - A CSS colour for the canvas tag's square. Defaults tonil.class(:any) - Defaults tonil.- Global attributes are accepted. Supports all globals plus:
["href", "navigate", "patch", "method", "download", "name", "value", "disabled"].
Slots
inner_block(required)
Attributes
class(:any) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)