About Form Pill Group
Form Pill Group is an interactive component for managing collections of items that users can select, deselect, and remove. Use it for multi-select interfaces, tag management, or any scenario where users need to manage a list of discrete items.Components
- FormPillGroup - Container for form pills
- FormPill - Individual interactive pill
- useFormPillState - Hook for managing pill state
Installation
Usage
Props
FormPillGroup
Also accepts state props fromuseFormPillState.
FormPill
Also accepts state props fromuseFormPillState.
State Management
UseuseFormPillState to manage keyboard navigation and selection:
Removable Pills
Pills withonDismiss show a close button:
Selectable Pills
Pills can be selected/deselected:Size Variants
Default Size
Large Size
Variant Types
Listbox Variant (default)
Standard selectable pills:Tree Variant
Allows pills to trigger other elements like dialogs:With Icons
Add icons to pills:Keyboard Navigation
Form Pill Group supports keyboard interaction:- Arrow keys - Navigate between pills
- Enter - Toggle pill selection
- Delete/Backspace - Remove focused pill (if dismissible)
- Tab - Move focus in/out of group
Accessibility
- Uses
role="listbox"orrole="tree"for proper semantics - Each pill has
role="option"orrole="treeitem" - Keyboard navigation fully supported
- Selected state announced to screen readers
- Keyboard controls visually hidden but available to assistive tech
- Requires
aria-labelfor context
Common Use Cases
Tag Management
Multi-Select Filter
Recipient List
Best Practices
Do
- Provide clear
aria-labelfor the group - Use for managing collections of items
- Allow removal of items when appropriate
- Limit visible pills (consider scrolling or “show more”)
Don’t
- Don’t use for read-only data (use Display Pill Group)
- Don’t show too many pills at once
- Don’t forget keyboard controls
- Don’t use for single selection (use Radio Group)
Related components
- Display Pill Group - For read-only pills
- Checkbox Group - For traditional multi-select
- Combobox - For searchable multi-select