Removable tag component with dot indicator and close button.
Tags are compact labels with a rounded-md shape. They differ from chips
(which are rounded-full and toggleable) by being simpler, non-toggleable
labels that can optionally be dismissed.
Variants
| Variant | Visual |
|---|---|
:default | Muted background, subtle border |
:primary | Primary color background |
:success | Green/success background |
:warning | Yellow/warning background |
:error | Red/destructive background |
:outline | Border only, transparent background |
Examples
<.tag label="Elixir" />
<.tag label="Important" variant={:error} dot />
<.tag label="Feature" variant={:primary} dismissible on_dismiss="remove_tag" value="feature" />
<.tag label="Custom" variant={:success} size={:lg}>
<:icon><svg>...</svg></:icon>
</.tag>
Summary
Functions
Renders an inline <span> styled as a removable tag.
Functions
Renders an inline <span> styled as a removable tag.
Tags support a dot indicator, an optional leading icon slot, and a dismissible close button that fires a Phoenix event.
Example
<.tag label="Elixir" variant={:primary} dot />
<.tag label="Draft" variant={:outline} dismissible on_dismiss="remove_tag" value="draft" />Attributes
label(:string) (required) - Tag text content.variant(:atom) - Visual style variant. Controls background, text colour, and border. Defaults to:default. Must be one of:default,:primary,:success,:warning,:error, or:outline.size(:atom) - Size of the tag. Controls height, padding, and font size. Defaults to:default. Must be one of:sm,:default, or:lg.dismissible(:boolean) - Show close button. Defaults tofalse.on_dismiss(:string) - Phoenix event name for dismiss. Defaults tonil.value(:string) - Value sent with dismiss event. Defaults tonil.dot(:boolean) - Show colored dot indicator. Defaults tofalse.class(:string) - Additional CSS classes merged viacn/1. Defaults tonil.- Global attributes are accepted. HTML attributes forwarded to the root
<span>element.
Slots
icon- Optional leading icon.