Component for automatically hiding elements with dynamic adaptation to the container width.

Supports two modes of operation:

  • Hiding from the end (default).
  • Hiding from the start.

Configurable via the reverseOverflowOrder attribute.

Item0 Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19
and 0 more

The order in which elements are hidden is determined using the order attribute for the KbqOverflowItem directive.

Item0 Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19
and 0 more

If you need some elements to always remain visible, you can use the alwaysVisible attribute for the KbqOverflowItem directive.

Item0 Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19
and 0 more

Element alignment within the container is set using the CSS property justify-content.

Item0 Item1 Item2 Item3 Item4 Item5 Item6
and 0 more

By default, elements are hidden horizontally. If you need to hide elements vertically, you can use the orientation="vertical" attribute.

Item0 Item1 Item2 Item3 Item4 Item5 Item6 Item7 Item8 Item9 Item10 Item11 Item12 Item13 Item14 Item15 Item16 Item17 Item18 Item19
and 0 more

The delay for hiding/showing elements is set using the debounceTime attribute. Enabling this option positively affects performance when there are many elements or when the container size changes frequently.

<div kbqOverflowItems [debounceTime]="300">...</div>

Sometimes the container size can change not only when the browser window is resized, but also when other elements on the page change size (for example: Sidebar). To track such changes, you can use the additionalResizeObserverTargets attribute. The attribute accepts either a single element or an array of elements whose size changes will trigger recalculation of hidden elements. By default, document.body is tracked.

<div kbqOverflowItems [additionalResizeObserverTargets]="sidebarContainerElement">...</div>
Suggestions for improvement
If you found a mistake or want to improve the article, create an issue on GitHub.