UNPKG

@carbon/react

Version:

React components for the Carbon Design System

77 lines (76 loc) 3.04 kB
/** * Copyright IBM Corp. 2016, 2026 * * 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, { type HTMLAttributes, type MouseEventHandler, type PropsWithChildren } from 'react'; /** Props shared between `TableRow` and `TableExpandRow`. */ export interface TableRowExpandInteropProps { /** * @deprecated Use `aria-label` instead. */ ariaLabel?: string; /** * Specify the string read by a voice reader when the expand trigger is * focused */ 'aria-label'?: string; /** * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow */ 'aria-controls'?: 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?: MouseEventHandler<HTMLButtonElement>; /** * Specify if the row is selected. */ isSelected?: boolean; /** * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43 */ expandHeader?: string; } export interface TableExpandRowProps extends PropsWithChildren<Omit<HTMLAttributes<HTMLTableRowElement>, 'onClick'>>, Omit<TableRowExpandInteropProps, 'aria-label' | 'onExpand'> { /** * Space separated list of one or more ID values referencing the TableExpandedRow(s) being controlled by the TableExpandRow */ '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; /** * The id of the matching th node in the table head. Addresses a11y concerns outlined here: https://www.ibm.com/able/guidelines/ci162/info_and_relationships.html and https://www.w3.org/TR/WCAG20-TECHS/H43 */ expandHeader?: string; /** * 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: MouseEventHandler<HTMLButtonElement>; } declare const TableExpandRow: React.ForwardRefExoticComponent<TableExpandRowProps & React.RefAttributes<HTMLTableCellElement>>; export default TableExpandRow;