Chip
A small label for a tag, a count or a status.
Usage
It never wraps or shrinks. Put the spacing on the container.
tsx
<div className="flex flex-wrap gap-2">
<List array={tags} itemExtractor={({ row }) => <Chip key={row}>{row}</Chip>} />
</div>typescript
tailwind
react
As a filter
active inverts the colours. For a filter, render it as a button.
tsx
const [selected, setSelected] = useState("all");
<div className="flex flex-wrap gap-2">
<List
array={tags}
itemExtractor={({ row }) => (
<Chip
key={row}
as="button"
active={selected === row}
aria-pressed={selected === row}
onClick={() => setSelected(row)}
>
{row}
</Chip>
)}
/>
</div>Reference
| prop | type | default | |
|---|---|---|---|
as? | ElementType | "div" | the element or component to render |
active? | boolean | false | inverted colours; visual only |
className? | string | — | added after the component's own class: what you set wins |
…rest | props of as | — | typed against the chosen element |