Installation#
npmpnpmyarnbun
Examples#
Default#
Default
Multiple Tags#
Multiple Tags
Removable Tags#
Use the onRemove prop to make tags removable.
Removable
Interactive Tag List#
Interactive Tags
Tag Input#
Tag Input
Filter Tags#
Filter Tags
Category Labels#
Category Labels
Skill Tags#
Skill Tags
Selected Items#
Selected Items
Usage#
Import
import { Tag } from "@sugarcoat/ui-nxt";Usage
// Static tag
<Tag>Category</Tag>
// Removable tag
<Tag onRemove={() => handleRemove()}>
Removable
</Tag>Props#
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | - | Content of the tag |
| onRemove | () => void | - | Callback when remove button is clicked. When provided, shows a remove button. |
| className | string | - | Additional CSS classes |
| style | CSSProperties | - | Inline styles |
| onClick | () => void | - | Click handler for the entire tag |
Accessibility#
- Remove button includes
aria-label="Remove tag"for screen readers - Click events are properly handled with keyboard support
- When used for filtering, consider using
role="checkbox"oraria-pressedto indicate selection state - Provide clear visual feedback for interactive states