@carbon/ibm-products
Version:
Carbon for IBM Products
52 lines (51 loc) • 1.75 kB
TypeScript
/**
* Copyright IBM Corp. 2024, 2024
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/
import React, { PropsWithChildren, ReactNode } from 'react';
export interface TruncatedListProps extends PropsWithChildren {
as?: React.ElementType | string;
/**
* Optional class name for expand/collapse button.
*/
buttonClassName?: string;
/**
* The contents of the TruncatedList.
*/
children: ReactNode;
/**
* Provide an optional class to be applied to the containing node.
*/
className?: string;
/**
* Number of items to render and display when the list is truncated and collapsed.
* Scrolling is not enabled when collapsed. The smallest number is 1.
*/
collapsedItemsLimit?: number;
/**
* Maximum number of items to show when the list is expanded. All
* items are rendered when the list is expanded. Scrolling is enabled
* if there are more items to display than this number.
*/
expandedItemsLimit?: number;
/**
* Optional callback reports the collapsed state of the list.
*/
onClick?: (value: any) => void;
/**
* Text label for when the list is expanded.
*/
viewLessLabel?: string;
/**
* Callback function for building the label when the list is collapsed.
*/
viewMoreLabel?: (value: any) => ReactNode;
}
/**
* The `TruncatedList` allows consumers to control how many items are
* revealed to the user while giving the user the ability to expand
* and see the entire list.
*/
export declare let TruncatedList: React.ForwardRefExoticComponent<TruncatedListProps & React.RefAttributes<HTMLDivElement>>;