User
catnip-user displays a person as the compact avatar chip from the Catnip design language. Pass the person through name. Initials are derived from that name unless you set initials. Avatar color defaults to purple and can be overridden with color.
It is not a select field: there is no options list. interactive chooses whether the chip is a control:
false(default) — avatar + name, or avatar only whenhideName, with no action.truewithinteraction="click"(default when interactive) — pill button, no chevron.truewithinteraction="expand"— pill + chevron button. Put it in Dropdown’striggerslot when the person must be selectable.
Override the circle with the avatar slot (photo, SVG, or other content). The default slot overrides the visible name; name still drives initials and Unassigned.
Live example
<catnip-dropdown hide-label aria-label="Choose a person" .modelValue="name || 'unassigned'" @update:modelValue="onSelect">
<catnip-user slot="trigger" interactive interaction="expand" .name="name" .color="color" />
<catnip-dropdown-option value="unassigned" label="Unassigned">
<catnip-user />
</catnip-dropdown-option>
<catnip-dropdown-option value="Name Surname" label="Name Surname">
<catnip-user name="Name Surname" />
</catnip-dropdown-option>
</catnip-dropdown>
<catnip-user name="Name Surname" />
<catnip-user .hideName="true" name="Name Surname" />
<catnip-user interactive interaction="click" name="Name Surname" />
<catnip-user name="Some Person" color="#037257" />
<catnip-user interactive interaction="expand" name="Name Surname" initials="AB" disabled />
<catnip-user name="Name Surname">
<img slot="avatar" src="/avatar.jpg" alt="" />
Display name
</catnip-user>Initials
- Two or more words: first letter of the first two words (
Name Surname→ NS). - One word: first two letters (
Madonna→ MA). - Set
initialswhen the derived value is not what you want. Only the first two characters are shown.
An empty name shows the bundled user.unassigned copy with the built-in user icon. Set unassignedLabel to override that string on one instance. A slotted avatar replaces that icon. When using User as a Dropdown trigger, update name and color from the same selected person so the trigger avatar matches its option-row avatar.
Accessibility
interactiveusers are native buttons. Hover, pressed, selected, and focus-visible states match Figma.selectedis the open/pressed appearance when interactive. Dropdown also applies it viaaria-expandedon the host. The chevron rotates 180° in that state wheninteractionisexpand.- Non-interactive users do not enter the tab order.
- The visible name (or Unassigned) is the accessible name.
hideNamemoves that string ontoaria-label. Static avatar-only usesrole="img"so that label is exposed. - Avatar initials, the unassigned icon, and slotted avatars are decorative (
aria-hiddenon the circle). Keep slotted imagesalt="". - Do not encode status or permission using avatar color alone.