
Research
SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.
react-responsive-overflow-list
Advanced tools
A responsive React component that shows as many items as can fit within constraints, hiding overflow items behind a configurable overflow renderer
Responsive list for React that shows only items that fit and groups the rest into a customizable overflow element. Recalculates on resize.
🔗 Live demo: https://eliav2.github.io/react-responsive-overflow-list/
children (simple) or items + renderItem (structured)maxRows)npm i react-responsive-overflow-list
Install as a styled shadcn component with dropdown menu overflow:
# Radix UI primitives (recommended)
npx shadcn@latest add https://eliav2.github.io/react-responsive-overflow-list/r/styles/radix-vega/overflow-list.json
# Base UI primitives
npx shadcn@latest add https://eliav2.github.io/react-responsive-overflow-list/r/styles/base-vega/overflow-list.json
See shadcn/ui docs for usage.
In real apps, you’ll typically wrap OverflowList in your own component—design tokens, accessible menus, virtualization, or search. See 'Wrap & extend' below and the demo for a full wrapper example.
renderItem (most common)Minimal usage with an items array and render function.
import { OverflowList } from "react-responsive-overflow-list";
const items = ["One", "Two", "Three", "Four", "Five"];
export default function Example() {
return (
<OverflowList
items={items}
renderItem={(item) => <span style={{ padding: 4 }}>{item}</span>}
style={{ gap: 8 }} // root is display:flex; flex-wrap:wrap
maxRows={1}
/>
);
}
Use children instead of items + renderItem.
<OverflowList style={{ gap: 8 }}>
<button>A</button>
<button>B</button>
<button>C</button>
<button>D</button>
</OverflowList>
Provide your own overflow UI (button, menu, details/summary, etc.).
<OverflowList
items={items}
renderItem={(item) => <span>{item}</span>}
renderOverflow={(hidden) => <button>+{hidden.length} more</button>}
/>
Render using a different HTML element via as.
<OverflowList as="nav">
<a href="#home">Home</a>
<a href="#about">About</a>
<a href="#contact">Contact</a>
</OverflowList>
Trade visual smoothness vs peak performance during rapid resize.
<OverflowList
items={items}
renderItem={(item) => <span>{item}</span>}
flushImmediately={false} // uses rAF; faster under rapid resize, may flicker briefly
/>
See the Flush Immediately example in the live demo.
| Prop | Type | Default | Notes |
|---|---|---|---|
items | T[] | — | Use with renderItem. Omit when using children. |
renderItem | (item: T, index: number) => ReactNode | — | How to render each item. |
children | ReactNode | — | Alternative to items + renderItem. |
as | React.ElementType | "div" | Polymorphic root element. |
maxRows | number | 1 | Visible rows before overflow. |
maxVisibleItems | number | 100 | Hard cap on visible items. |
renderOverflow | (hidden: T[]) => ReactNode | default chip | Custom overflow UI. |
renderOverflowItem | (item: T, i: number) => ReactNode | renderItem | For expanded lists/menus. |
renderOverflowProps | Partial<OverflowElementProps<T>> | — | Props for default overflow. |
flushImmediately | boolean | true | true (flushSync, no flicker) vs false (rAF, faster under resize). |
renderItemVisibility | (node: ReactNode, meta: RenderItemVisibilityMeta) => ReactNode | internal | Control visibility of hidden items (defaults to React.Activity if available, otherwise simply return null). |
Styles: Root uses display:flex; flex-wrap:wrap; align-items:center;. Override via style/className.
Default overflow element: A tiny chip that renders +{count} more. Replace via renderOverflow.
It’s expected you’ll wrap OverflowList for product needs (design system styling, a11y menus, virtualization, search). for example:
Radix UI + Virtualization wrapper (search, large datasets, a11y, perf):
@tanstack/react-virtual and the helper createLimitedRangeExtractor(...).maxRows.flushImmediately=true → immediate, flicker-free (uses flushSync).
flushImmediately=false → defer with rAF; smoother under rapid resize, may flicker.
maxRows / maxVisibleItems respectedReact.Activity so overflowed children stay mounted while toggling visibility.renderItemVisibility if you need to keep custom
elements or skeletons mounted and control visibility yourself.ResizeObserverMIT
FAQs
A responsive React component that shows as many items as can fit within constraints, hiding overflow items behind a configurable overflow renderer
The npm package react-responsive-overflow-list receives a total of 1,356 weekly downloads. As such, react-responsive-overflow-list popularity was classified as popular.
We found that react-responsive-overflow-list demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
An emerging npm supply chain attack that infects repos, steals CI secrets, and targets developer AI toolchains for further compromise.

Company News
Socket is proud to join the OpenJS Foundation as a Silver Member, deepening our commitment to the long-term health and security of the JavaScript ecosystem.

Security News
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.