Tag
Labels an item with a short attribute, such as a platform, category, or event type.
Default
build.completed
test_run.completed
preview.uploaded
<.tag label="build.completed" />
<.tag label="test_run.completed" />
<.tag label="preview.uploaded" />
With icon
An icon before the label makes the value easier to scan.
<.tag label="iOS" icon="device_mobile" />
<.tag label="macOS" icon="device_laptop" />
<.tag label="main" icon="git_branch" />
Dismissible
A dismiss button sends
on_dismiss
with the tag's
dismiss_value
.
Status: Failed
<.tag label="Status: Failed" dismissible on_dismiss="remove-filter" dismiss_value="status" />
<.tag
label="iOS"
icon="device_mobile"
dismissible
on_dismiss="remove-filter"
dismiss_value="platform"
/>
Disabled
Mutes the tag and disables its dismiss button.
Archived
Status: Failed
<.tag label="Archived" disabled />
<.tag label="watchOS" icon="device_watch" disabled />
<.tag
label="Status: Failed"
dismissible
on_dismiss="remove-filter"
dismiss_value="status"
disabled
/>
Input tag
For values entered into a field, with an optional dismiss button.
<.input_tag
dismissible
on_dismiss="remove-email"
/>
<.input_tag
dismissible
on_dismiss="remove-email"
/>
Guidelines
- Use tags for neutral attributes such as platforms, categories, and event types. For states and outcomes, use a badge or a status badge.
-
Add an
iconwhen it makes the value faster to recognize, such as a device icon for a platform. -
A dismissible tag sends
on_dismissto the server withdismiss_valueas thedataparameter. The tag does not hide itself, so remove it from your assigns in the handler. -
Use
input_tagfor values a person typed into a field, such as email addresses in an invite form. It has no icon and uses the parts the tags input hook reads.
API reference
<.tag>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
disabled
|
boolean
|
false
|
Whether the tag is disabled.
|
|
dismiss_value
|
string
|
nil
|
Value to pass to the dismiss event.
|
|
dismissible
|
boolean
|
false
|
Whether the tag can be dismissed.
|
|
icon
|
string
|
nil
|
An icon to render in front of the label.
|
|
label
Required
|
string
|
–
|
The label of the tag.
|
|
on_dismiss
|
string
|
nil
|
The event to trigger when the tag is dismissed.
|
Also accepts global attributes.
<.input_tag>
| Attribute | Type | Default | Description |
|---|---|---|---|
|
disabled
|
boolean
|
false
|
Whether the tag is disabled.
|
|
dismiss_value
|
string
|
nil
|
Value to pass to the dismiss event.
|
|
dismissible
|
boolean
|
false
|
Whether the tag can be dismissed.
|
|
label
Required
|
string
|
–
|
The label of the tag.
|
|
on_dismiss
|
string
|
nil
|
The event to trigger when the tag is dismissed.
|
Also accepts global attributes.