Usage
import { DropdownSection } from 'nr1'
Props
This component can render either declaratively, by directly passing a set of children or virtualized, by passing a render callback (function as children).
The only items allowed inside (or returned by the render callback)
are of type <DropdownItem>
.
The recommendation is to use the render callback when a large number of items is provided, since the item list will be virtualized by the component, thus increasing the performance.
Appends class names to the component.
Should be used only for positioning and spacing purposes.
Items to render, in the shape of a list of objects. Usually, each
item in the items array contains the required data to generate the
corresponding <DropdownItem>
.
This prop is required when rendering items with the render callback (function as children).
Callback fired when more items must be loaded. This happens when
you're lazy loading the items and the items that are about to render
cannot be found in the items
array.
This callback should be used to fetch/load the missing items from the backend or other sources.
The returned Promise should be resolved once item data has finished loading. It will be used to determine when to refresh the list with the newly-loaded data. This callback may be called multiple times in reaction to a single scroll event.
function (cursor: Cursor Items to load.
)
Number of rows.
By default it's equal to length of array passed in the items prop.
You should specify the rowCount
when you know the total number of
items but you want to lazy load them while scrolling.
Inline style for custom styling.
Should be used only for positioning and spacing purposes.
Adds a data-test-id
attribute. Use it to target the component in unit and
E2E tests.
For a test id to be valid, prefix it with your nerdpack id, followed up by a dot.
For example, my-nerdpack.some-element
.
Note: You might not see data-test-id
attributes as they are removed
from the DOM, to debug them pass a e2e-test
query parameter to the URL.
""
Section title.
Type definitions
Cursor
{startIndex: number, First index of the range of items to load.
stopIndex: number, Last index of the range of items to load.
}