Tag

A compact element for labeling, categorizing, or filtering content

Installation#

npmpnpmyarnbun
npx sugarcoat add tag

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#

PropTypeDefaultDescription
childrenReactNode-Content of the tag
onRemove() => void-Callback when remove button is clicked. When provided, shows a remove button.
classNamestring-Additional CSS classes
styleCSSProperties-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" or aria-pressed to indicate selection state
  • Provide clear visual feedback for interactive states
Customize Theme
Build your own sugarcoat/ui theme
PresetLime / Violet / Slate
Brand ColorLime
Accent ColorViolet
Gray ScaleSlate
Border RadiusLg