@carbon/react
Version:
React components for the Carbon Design System
109 lines (108 loc) • 4.49 kB
TypeScript
/**
* Copyright IBM Corp. 2016, 2025
*
* 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 PropTypes from 'prop-types';
import React, { type HTMLAttributes } from 'react';
export type TableExpandHeaderPropsBase = {
/**
* Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandHeader
*/
['aria-controls']?: string;
/**
* @deprecated This prop has been deprecated and will be
* removed in the next major release of Carbon. Use the
* `aria-label` prop instead.
*/
ariaLabel?: string;
/**
* Specify the string read by a voice reader when the expand trigger is
* focused
*/
['aria-label']?: string;
/**
* @deprecated The enableExpando prop is being replaced by `enableToggle`
*/
enableExpando?: false | undefined;
/**
* Specify whether an expand all button should be displayed
*/
enableToggle?: false | undefined;
/**
* The description of the chevron right icon, to be put in its SVG `<title>` element.
*/
expandIconDescription?: string;
/**
* Specify whether this row is expanded or not. This helps coordinate data
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
*/
isExpanded?: boolean;
/**
* Hook for when a listener initiates a request to expand the given row
*/
onExpand?(event: React.MouseEvent<HTMLButtonElement>): void;
} & HTMLAttributes<HTMLTableCellElement>;
export type TableExpandHeaderPropsWithToggle = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableToggle' | 'onExpand'> & {
enableToggle: true;
['aria-label']: string;
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
};
export type TableExpandHeaderPropsWithExpando = Omit<TableExpandHeaderPropsBase, 'aria-label' | 'enableExpando' | 'onExpand'> & {
/**
* @deprecated The enableExpando prop is being replaced by `enableToggle`
*/
enableExpando: true;
['aria-label']: string;
onExpand(event: React.MouseEvent<HTMLButtonElement>): void;
};
export type TableExpandHeaderProps = TableExpandHeaderPropsWithToggle | TableExpandHeaderPropsWithExpando | TableExpandHeaderPropsBase;
declare const TableExpandHeader: {
({ ["aria-controls"]: ariaControls, ["aria-label"]: ariaLabel, ariaLabel: deprecatedAriaLabel, className: headerClassName, enableExpando, enableToggle, id, isExpanded, onExpand, expandIconDescription, children, ...rest }: TableExpandHeaderProps): import("react/jsx-runtime").JSX.Element;
propTypes: {
/**
* Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandHeader
*/
"aria-controls": PropTypes.Requireable<string>;
/**
* Specify the string read by a voice reader when the expand trigger is
* focused
*/
"aria-label": PropTypes.Requireable<string>;
/**
* Deprecated, please use `aria-label` instead.
* Specify the string read by a voice reader when the expand trigger is
* focused
*/
ariaLabel: PropTypes.Requireable<string>;
children: PropTypes.Requireable<PropTypes.ReactNodeLike>;
className: PropTypes.Requireable<string>;
/**
* The enableExpando prop is being replaced by TableExpandHeader
*/
enableExpando: (props: Record<string, any>, propName: string, componentName: string, ...rest: any[]) => any;
/**
* Specify whether an expand all button should be displayed
*/
enableToggle: PropTypes.Requireable<boolean>;
/**
* The description of the chevron right icon, to be put in its SVG `<title>` element.
*/
expandIconDescription: PropTypes.Requireable<string>;
/**
* Supply an id to the th element.
*/
id: PropTypes.Requireable<string>;
/**
* Specify whether this row is expanded or not. This helps coordinate data
* attributes so that `TableExpandRow` and `TableExpandedRow` work together
*/
isExpanded: React.Validator;
/**
* Hook for when a listener initiates a request to expand the given row
*/
onExpand: PropTypes.Requireable<any>;
};
};
export default TableExpandHeader;