About Display Pill Group
Display Pill Group is a read-only component for displaying collections of labeled data. Use it to show tags, categories, or other grouped information that users can view but not edit.Components
- DisplayPillGroup - Container for display pills
- DisplayPill - Individual read-only pill
Installation
Usage
Props
DisplayPillGroup
DisplayPill
Basic Example
Display a collection of tags:With Icons
Include icons in pills:Displaying User Selections
Show what a user has selected:In Form Summaries
Show selected options in a form summary:Dynamic Content
Render pills from data:Empty State
Handle when there are no pills:Layout
DisplayPillGroup uses flexbox with wrapping:- Pills wrap to multiple lines automatically
- Consistent spacing between pills (space20)
- Aligns with parent container width
Accessibility
- Uses semantic
<ul>list structure - Requires
aria-labelto describe the collection - Each pill is a list item for proper screen reader navigation
- Keyboard users can navigate through pills
Display vs Form Pills
Use Display Pill Group when:
- Showing read-only data
- Displaying user selections in a summary
- Content cannot be modified
- No interaction is needed
Use Form Pill Group when:
- Users need to add/remove items
- Pills are editable or selectable
- Building a multi-select interface
- Managing a list of items
Best Practices
Do
- Use clear, concise labels for pills
- Provide meaningful
aria-labelfor the group - Limit the number of pills to avoid overwhelming users
- Use for displaying categorized or tagged data
Don’t
- Don’t use for interactive selection (use Form Pill Group)
- Don’t display too many pills (consider alternative layouts)
- Don’t use for data that changes frequently
- Don’t forget the
aria-labelattribute
Related components
- Form Pill Group - For editable pill collections
- Badge - For status indicators
- Tag - For single labels