noora
Sign in

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.

iOS
macOS
main
<.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
iOS
<.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
watchOS
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
  label="[email protected]"
  dismissible
  on_dismiss="remove-email"
  dismiss_value="[email protected]"
/>
<.input_tag
  label="[email protected]"
  dismissible
  on_dismiss="remove-email"
  dismiss_value="[email protected]"
/>
<.input_tag label="[email protected]" />

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 icon when it makes the value faster to recognize, such as a device icon for a platform.
  • A dismissible tag sends on_dismiss to the server with dismiss_value as the data parameter. The tag does not hide itself, so remove it from your assigns in the handler.
  • Use input_tag for 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.