Marigold
Marigold

Application

MarigoldProvider
RouterProvider

Layout

AppLayoutbeta
Aside
Aspect
Breakout
Center
Columns
Container
Grid
Inline
Inset
Scrollable
Split
Stack
Tiles

Actions

ActionBaralpha
Button
Link
LinkButton
ToggleButtonalpha
ToggleButtonGroupalpha

Form

Autocomplete
Calendarupdated
Checkbox
ComboBox
DateField
DatePicker
FileField
Form
Multiselectdeprecated
NumberField
Radio
SearchField
Select
Slider
Switch
TagFieldbeta
TextArea
TextField
TimeField

Collection

SelectList
Tableupdated
Tag

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ContextualHelp
Dialog
Drawer
Menu
Toastbeta
Tooltip

Content

Badge
Card
Divider
EmptyStatebeta
Headline
Icon
List
Loader
SectionMessage
SVG
Text

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useListData
useResponsiveValue
useTheme
VisuallyHidden
Components

TagField

A multi-select field that displays selected items as removable tags with a searchable dropdown.

The <TagField> component allows users to select multiple options from a dropdown list. Selected items are displayed as removable tags directly inside the input area, giving users a clear overview of their choices at a glance. The component includes a built-in search field for quickly filtering through large option sets.

<TagField> is ideal for scenarios where users need to pick several items from a predefined set, such as assigning categories, tagging content, or selecting multiple preferences. Unlike a standard multi-select dropdown, the tag-based display provides immediate visual feedback and makes it easy to add or remove individual selections.

The component is built on react-aria, providing full keyboard navigation, screen reader support, and accessible interactions out of the box.

Anatomy

A <TagField> consists of a label, a trigger area with tags and an add button, and a popover containing a search input and an options list.

Anatomy of TagField component
  • Label: Descriptive text guiding the user on what to select.

  • Container: The container area that displays selected tags and the button.

  • Tag: A removable chip representing a selected item. Users can click the remove icon to deselect.

  • Button: An icon button that opens the dropdown popover to add more selections.

  • Search input: A text field inside the popover that filters the available options as the user types.

  • Popover: The overlay container holding the search input and options list.

  • Section: A group of related options with a header label, used to organize options into categories.

  • Option: An individual selectable item in the dropdown list.

Appearance

The appearance of a component can be customized using the variant and size props. These props adjust the visual style and dimensions of the component, available values are based on the active theme.

The selected theme does not has any options for"variant" and "size".
Genres
Select genres...
PropertyTypeDescription
variant-The available variants of this component.
size-The available sizes of this component.

Usage

The <TagField> works best when users need to select multiple items from a list of options (10+) and want to see their selections displayed compactly as tags. It combines filtering (typing to narrow down options) with visible selection feedback, saving space compared to checkboxes.

Organizing options into sections

When the list of options becomes large or covers distinct categories, grouping them into sections helps users find what they are looking for. Use the <TagField.Section> component to wrap related options, providing a header for each group to add structure and context.

Genres
import { useState } from 'react';import { Key } from '@react-types/shared';import { TagField } from '@marigold/components';const categories = [  {    name: 'Rock and Alternative',    genres: [      { id: 'rock', name: 'Rock' },      { id: 'indie', name: 'Indie Rock' },      { id: 'punk', name: 'Punk Rock' },      { id: 'grunge', name: 'Grunge' },    ],  },  {    name: 'Electronic',    genres: [      { id: 'house', name: 'House' },      { id: 'techno', name: 'Techno' },      { id: 'ambient', name: 'Ambient' },    ],  },  {    name: 'Jazz and Blues',    genres: [      { id: 'jazz', name: 'Jazz' },      { id: 'blues', name: 'Blues' },      { id: 'bebop', name: 'Bebop' },    ],  },];export default () => {  const [selected, setSelected] = useState<Key[]>([]);  return (    <TagField label="Genres" value={selected} onChange={setSelected} width={80}>      {categories.map(category => (        <TagField.Section key={category.name} header={category.name}>          {category.genres.map(genre => (            <TagField.Option key={genre.id} id={genre.id}>              {genre.name}            </TagField.Option>          ))}        </TagField.Section>      ))}    </TagField>  );};

Preventing selection of specific options

In some cases, certain options should be visible but not selectable. For example, an option may be temporarily unavailable or restricted based on the user's permissions. Use the disabledKeys prop to mark specific options as non-interactive while keeping them visible in the list.

Genres
import { useState } from 'react';import { Key } from '@react-types/shared';import { TagField } from '@marigold/components';export default () => {  const [selected, setSelected] = useState<Key[]>([]);  return (    <TagField      label="Genres"      value={selected}      onChange={setSelected}      disabledKeys={['classical', 'electronic']}      width={80}    >      <TagField.Option id="rock">Rock</TagField.Option>      <TagField.Option id="jazz">Jazz</TagField.Option>      <TagField.Option id="pop">Pop</TagField.Option>      <TagField.Option id="classical">Classical</TagField.Option>      <TagField.Option id="electronic">Electronic</TagField.Option>    </TagField>  );};

Keep option text concise

Option labels should be short and scannable so users can quickly identify the items they need. Long or overly detailed labels slow down the selection process, especially when users are filtering by typing in the search field.

Do

Use short, recognizable option labels like "Rock", "Jazz", or "Electronic".

Don't

Don't use long descriptions as option labels, such as "Rock and Roll (including classic and modern sub-genres)".

Labeling

For general guidance on labels, placeholders, and help text, refer to the Form Fields foundation page.

Accessibility

The <TagField> supports full keyboard navigation through all its interactive parts.

KeyDescription
TabMoves focus between the trigger, tags, add button, and other focusable elements.
EnterOpens the popover when the trigger or add button is focused. Selects or deselects an option when focused in the list.
SpaceOpens the popover when the trigger or add button is focused.
Arrow Up / Arrow DownNavigates between options in the dropdown list.
Arrow Left / Arrow RightNavigates between tags in the trigger area.
EscapeCloses the popover and returns focus to the trigger.
BackspaceRemoves a tag when it is focused.

When the popover opens, the search input receives focus automatically, allowing users to immediately start filtering options by typing.

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
View TagField stories

TagField

Prop

Type

TagField.Option

Prop

Type

TagField.Section

Prop

Type

Alternative components

  • ComboBox: When users need to select a single value from a filterable list, or when they should be able to type a custom value.
  • Select: When users need to choose a single option from a dropdown without a search field.
  • SelectList: When you need more than just a text label to represent options and want a persistent, visible list.
  • Checkbox: When there are fewer than 10 options and all choices should be visible at once without a dropdown.

Related

Multiple Selection

Guidelines for implementing multiple selection patterns.

Form development guide

Learn how to build forms.

Form Fields

Learn about form field foundations.
Last update: 10 days ago

Switch

Component that switches between two states.

TextArea

Component for entering multiline text input.

On this page

AnatomyAppearanceUsageOrganizing options into sectionsPreventing selection of specific optionsKeep option text conciseLabelingAccessibilityPropsTagFieldTagField.OptionTagField.SectionAlternative componentsRelated