1 | @# Collapsible list
|
2 |
|
3 | The `CollapsibleList` component accepts a list of menu items and a count of
|
4 | visible items. It shows precisely that many items and collapses the rest into a
|
5 | dropdown menu. The required `visibleItemRenderer` callback prop allows for
|
6 | customizing the appearance of visible items, using the props from the `MenuItem`
|
7 | children.
|
8 |
|
9 | <div class="@ns-callout @ns-intent-danger @ns-icon-error">
|
10 | <h4 class="@ns-heading">
|
11 |
|
12 | Deprecated: use [Overflow list](#core/components/overflow-list)
|
13 | </h4>
|
14 |
|
15 | This component is **deprecated since 3.0.0** with the introduction of
|
16 | [`OverflowList`](#core/components/overflow-list) which provides a similar
|
17 | experience with two distinct advantages:
|
18 |
|
19 | <ol>
|
20 | <li>Items collapse automatically based on available space in the container.</li>
|
21 | <li>
|
22 |
|
23 | `OverflowList` accepts a generic array of items (instead of explicit
|
24 | `<MenuItem>` children) with custom renderers for both visible and overflowed
|
25 | items, allowing for _any_ UI, not just a dropdown menu.
|
26 |
|
27 | </li>
|
28 | </ol>
|
29 |
|
30 | </div>
|
31 |
|
32 | @reactExample CollapsibleListExample
|
33 |
|
34 | @## Separators
|
35 |
|
36 | Often a list of items calls for separators between each item.
|
37 | Adding separators to a `CollapsibleList` is easily achieved via CSS using `::after` pseudo-elements.
|
38 |
|
39 | ```css.scss
|
40 | // pass `visibleItemClassName="my-list-item"` to component, then...
|
41 |
|
42 | .my-list-item::after {
|
43 | display: inline-block;
|
44 | content: "";
|
45 | // custom separator styles...
|
46 | }
|
47 |
|
48 | // remove separator after the last item
|
49 | .my-list-item:last-child::after {
|
50 | display: none;
|
51 | }
|
52 | ```
|
53 |
|
54 | @## Props
|
55 |
|
56 | Children of the `CollapsibleList` component _must_ be `MenuItem`s so they can be easily rendered
|
57 | in the dropdown. Define a `visibleItemRenderer` callback to customize the appearance of visible
|
58 | items using their [`IMenuItemProps`](#core/components/menu.menu-item).
|
59 |
|
60 | @interface ICollapsibleListProps
|