@octopusdeploy/design-system-components
Version:
The design systems component library.
48 lines (47 loc) • 1.76 kB
TypeScript
import * as React from "react";
interface RenderListRowProps<T> {
/**
* The current item being rendered.
*/
item: T;
index: number;
}
export interface ListProps<T> {
/**
* An optional empty value to display when the list is empty.
*/
empty?: React.ReactNode;
/**
* The items to use for the list.
*/
items: ReadonlyArray<T>;
/**
* A render function which defines how the row should be displayed.
*/
renderRow: (props: RenderListRowProps<T>) => React.ReactNode;
/**
* An optional function which defines the react key to use for each row.
* Every row should have a unique row key and we default to the index of the row
* for legacy reasons. Please treat this prop as required for any new usages.
*/
rowKey?: (item: T) => string;
/***
* A boolean flag indicating whether vertical padding should be included above
* and below this list.
* @deprecated we do not want to include vertical padding as part of our components, as such this
* prop will be removed in the near future. Padding should be handled in consumers, possibly using
* layout components.
*/
includeVerticalPadding?: boolean;
/***
* A boolean flag indicating whether the list should contain gaps between rows. This can be useful
* when the items in the list are bordered and some space is required between each item.
*/
includeRowGaps?: boolean;
/**
* The accessible name of the List component.
*/
accessibleName?: string;
}
export declare function List<T>({ items, rowKey, renderRow, empty, includeRowGaps, includeVerticalPadding, accessibleName }: ListProps<T>): import("react/jsx-runtime").JSX.Element;
export {};