Mosmox UI
Current version
GitHubnpmjs.com
Feedback & Status

Tag / Chip

Compact labels for entities, filters, selected values, and removable metadata.

Tag is the universal compact label component for an entity or value. It can remain static, behave as a selectable filter, link to another view, or expose a dedicated remove action. Use Tag for readable statuses, categories, filters, identities, and removable values. Badge is intentionally narrower and is reserved for numeric, short-count, and dot indicators.

Basic usage

<Tag tone="primary">React</Tag>
<Tag tone="success" icon={<CheckIcon size={14} />}>Published</Tag>
<Tag avatar={<Avatar src="/maya.jpg" alt="Maya Chen" />}>Maya Chen</Tag>

Selectable filters

Use selectable when a tag behaves like a compact toggle or filter. The selected state can be controlled or managed internally:

const [selected, setSelected] = useState(false);

<Tag
  selectable
  selected={selected}
  onSelectedChange={setSelected}
  tone="primary"
>
  Needs review
</Tag>

Selectable tags expose aria-pressed and support Enter and Space. Use a group-level label when several tags form a filter group.

Removable values

<Tag
  removable
  onRemove={() => removeFilter('TypeScript')}
  removeLabel="Remove TypeScript filter"
>
  TypeScript
</Tag>

The remove control is a separate keyboard-accessible button and does not activate the parent tag. This makes the component suitable for selected filters, recipients, categories, and multi-value inputs.

tone supports neutral, primary, secondary, success, warning, and danger. variant supports solid, soft, outline, and light; size supports xs, sm, default, and lg; and shape supports rounded, pill, and square.

Use href for a link-like tag, icon for a leading icon, avatar for an identity, loading while a tag action is in progress, disabled when it cannot be changed, and truncate for long values.

API Reference

PropertyTypeDefaultDescription
childrenReactNode—Tag label or content.
tone'neutral' | 'primary' | 'secondary' | 'success' | 'warning' | 'danger''neutral'Semantic color.
variant'solid' | 'soft' | 'outline' | 'light''soft'Visual treatment.
size'xs' | 'sm' | 'default' | 'lg''default'Density preset.
shape'rounded' | 'pill' | 'square''pill'Corner treatment.
iconReactNode—Leading icon.
avatarReactNode—Identity content; takes precedence over icon.
selectablebooleanfalseMakes the tag a toggle.
selectedboolean—Controlled selected state.
defaultSelectedbooleanfalseInitial uncontrolled selected state.
onSelectedChange(selected: boolean) => void—Called when a selectable tag changes.
removablebooleanfalseShows the remove button.
onRemove(event) => void—Called by the remove button.
removeLabelstring'Remove tag'Accessible remove-button label.
hrefstring—Renders the tag as a link.
onClick(event) => void—Handles activation.
closeIconReactNodeXCustom remove-button icon.
loadingbooleanfalseShows loading and disables interaction.
disabledbooleanfalseDisables interaction.
truncatebooleanfalseTruncates long content.
titlestring—Native tooltip/title attribute.
idstring—Root element id.
classNamestring—Additional root class.
styleCSSProperties—Additional root styles.