API Reference

Complete documentation of all props and types for the OverflowList component.

Props

PropTypeDefaultDescription
itemsT[]Array of items to render. Use with renderItem. Omit when using children.
renderItem(item: T, index: number) => ReactNodeHow to render each visible item.
childrenReactNodeAlternative to items + renderItem pattern.
asReact.ElementType"div"Polymorphic root element.
maxRowsnumber1Number of visible rows before overflow.
maxVisibleItemsnumber100Hard cap on visible items.
renderOverflow(hidden: T[]) => ReactNodeCustom overflow UI. Receives array of hidden items.
renderOverflowItem(item: T, index: number) => ReactNodeHow to render items in expanded lists/menus. Defaults to renderItem.
renderOverflowPropsPartial<OverflowElementProps<T>>Props passed to the default overflow element.
flushImmediatelybooleantruetrue uses flushSync for no flicker. false uses rAF for better performance during rapid resize.
renderItemVisibility(node: ReactNode, meta: RenderItemVisibilityMeta) => ReactNodeControl visibility of hidden items. Defaults to React.Activity (19.2+) or null.

Styling

The root element uses display: flex; flex-wrap: wrap; align-items: center; by default. Override via style or className props.

Default Overflow Element

Ships with a minimal chip that renders +{count} more. Replace with renderOverflow for custom UI like dropdown menus.

TypeScript

import type {
  OverflowListProps,
  RenderItemVisibilityMeta,
  OverflowElementProps,
} from "react-responsive-overflow-list";

How It Works

  1. Measures all items and computes how many fit within maxRows
  2. Re-tests with the overflow indicator; if it would create a new row, hides one more item
  3. Renders the stable "normal" state until container size changes

Performance Notes

  • flushImmediately=true — Immediate, flicker-free (uses flushSync)
  • flushImmediately=false — Defer with rAF; smoother under rapid resize but may flicker briefly

React Version Notes

  • React 19.2+: Hidden items use React.Activity so overflowed children stay mounted while toggling visibility.
  • React 16–18: Overflowed nodes unmount during measurement. Use renderItemVisibility if you need custom visibility control.

Requirements

  • React ≥ 16.8 (hooks)
  • Modern browsers with ResizeObserver