All components (283)
Overflow list
Utilities · OverflowList
What it is and when to use it
A row of items that never wraps: those that do not fit are gathered in a "+3" button that shows them. It is really measured, so it does not matter how much each one measures.
When to use it
- Tags in a table cell or a card, people on a team, applied filters.
maxVisiblesets a limit even if more would fit.
When not to
- Breadcrumbs:
Breadcrumbsalready clips its own. - Actions:
ActionMenu.
Keyboard: Tab reaches the "+N" button; Enter opens the panel and Escape closes it.
Accessibility: the button says how many are missing ("3 more") and whether it is open. What does not fit does not stay in the document twice: it leaves the group and enters the panel.
Fine-tuning: --amset-overflowlist-gap is the gap between items.
What it looks like
<OverflowList
label="Product tags"
items={etiquetas}
itemKey={(etiqueta) => etiqueta}
renderItem={(etiqueta) => <Tag>{etiqueta}</Tag>}
/>Props
Import it with import { OverflowList } from '@amset/ui'. Required props are marked.
| Prop | Type | What it does |
|---|---|---|
itemsrequired | readonly Item[] | — |
labelrequired | string | What the list is: "Tags". It names the list and the panel of those that do not fit. |
className | string | Merged with the library classes; it does not replace them. |
collapseFrom | "start" | "end" | Which side is cut: `end` hides the last ones, `start` the first ones. Defaults to `end`. |
defaultOpen | boolean | — |
gap | number | Space between items, in pixels. Defaults to the theme one. |
itemKey | (item: Item, index: number) => string | The stable key of each item. By default, its position: with a list that changes, it is better to give it. |
maxRows | number | How many rows are allowed before the rest is gathered into «+N». Defaults to 1. |
maxVisible | number | A limit, even if more would fit. Without this, those that fit. |
onOpenChange | (open: boolean) => void | — |
open | boolean | Panel controlled from outside. |
openOnHover | boolean | Opens the panel when the mouse goes over the button, as well as on click. |
renderItem | (item: Item, index: number) => ReactNode | How each item is painted. By default, its text or its `label`. |
renderOverflow | (hidden: readonly Item[], controls: OverflowControls) => ReactNode | How the content of the panel of the hidden ones is drawn. Defaults to a list using `renderItem`. |
It also accepts the attributes of the element it renders: className, style, data-*, aria-* and its events.
In the test bench
Every state and variant, to try one at a time, on its page at storybook.amsetui.com:
