A text based element for displaying user-provided data or selections.
One
Two
Three
Open in Playroom

Size

You can tailor the size of the tag via the size prop, which accepts either standard or small.
STANDARD
One
Two
Three
SMALL
One
Two
Three
Open in Playroom

Icons

For differentiation or to help communicate the meaning of the tag, an icon can be provided. This will be placed to the left of the text.
One
Two
Three
Open in Playroom

Actionable tags

Tags can be made actionable to support either being “cleared” or “added”.By providing an onClear handler and a clearLabel, a ButtonIcon component with a clear icon will be added to the right of the tag label.Alternatively, providing an onAdd handler and an addLabel will insert a ButtonIcon component with an add icon to the right of the tag label.Translation hint The aria-label for the button can be customised by providing the relevant clearLabel or addLabel prop.
ADDABLE
Four
Five
CLEARABLE
One
Two
Three
Open in Playroom

Interaction patterns

Use actionable tags to allow users to input data, make selections, define search criteria or filter content. Common patterns include selecting from a list or entering text in a form field. Below are examples of each.

Selecting from a list

Allows users to select items from a predefined list.
Available languages
Cantonese
German
Hindi
Indonesian Bahasa
Korean
Maori
Spanish
Urdu
Selected languages
Arabic
English
French
Mandarin
Open in Playroom

Form field input

Allows users to select items from a predefined list, enter their own items, or a combination of both. The example below uses Autosuggest to surface a predefined list, however additional approaches can be created using Dropdown or TextField.
Suggestions will appear below the field as you type
English
Indonesian Bahasa
Open in Playroom

When to use

Use a Tag:
  • To display discrete pieces of user-provided data
  • To allow users to make selections, define search criteria or filter content.
Don’t use a Tag:
  • To display the status of an object (use a Badge instead)
  • To perform actions other than “add” or “clear” (use a Button instead).

Data attributes

Braid components are very explicit about the properties they accept, which makes providing arbitrary data attributes not possible. Instead, a data prop can be provided as a single collection of data attributes.
<Tag
  data={{ testid: 'tag-1' }}
  // => data-testid="tag-1"
/>

Alternatives

  • Badge For communicating the status of an object.