Table tree

A table tree is an expandable table for showing nested hierarchies of information.

Installation

Package installation information
Installyarn add @atlaskit/table-tree
SourceBitbucket.org, (opens new window)
npm@atlaskit/table-tree, (opens new window)
Bundleunpkg.com, (opens new window)

Props

Table tree props

children

Description

The contents of the table. Use this when composing Cell, Header, Headers, Row, and Rows components. For basic usage, it's simpler to specify table contents with the items prop instead.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

columns

Description

Each column component is used to render the cells in that column. A cell's content value, specified in the data passed to items, is provided as props.

TypeElementType<any, keyof IntrinsicElements>[]

columnWidths

Description

The widths of the columns in the table.

TypeColumnWidth[]

headers

Description

The header text of the columns of the table.

Typestring[]

items

Description

The data used to render the table. If you're creating a basic table, use this prop instead of composing cell, header, headers, row, and rows components.

In addition to the `items` props, any other data can be added, and it will
be provided as props when rendering each cell.
TypeItem[]

label

Description

This is an aria-label attribute. Use the label to describe the table for assistive technologies. Usage of either this, or the labelId attribute is strongly recommended.

Typestring

mainColumnForExpandCollapseLabel

Description

The value used to extend the expand or collapse button label in cases where row has child rows. It should be a string when we pass data via the items property, the value should be one of the columns names. It should be a number when we pass data via the rows component as children in the table tree.

Typestring | number

referencedLabel

Description

This is an aria-labelledby attribute. Pass an ID for the element which should define an accessible name for the table. Usage of either this, or the label attribute is strongly recommended.

Typestring

shouldExpandOnClick

Description

Use this to set whether a row with children should expand when clicked anywhere within the row. If false or unset, a row with children will only expand when the chevron is clicked.

If your cells contain interactive elements, always set this to `false` to avoid unexpected expanding or collapsing.

If you aren't using the `items` prop, `shouldExpandOnClick` should be used on the row component instead.
Typeboolean

Headers props

The Headers component does not take any props.

Header props

children

Description

The contents of the header.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

id

Description
No description.
Typestring

onClick

Description
No description.
Type() => void

role

Description
No description.
Typestring

width

Description

Width of the header item. Takes a string, or a number representing the width in pixels.

Typestring | number

Rows props

items

Description

The data used to render the set of rows. Will be passed down via the children render prop.

In addition to these props, any other data can be added to the object, and it will be provided as props when rendering each cell.

TypeItem[]

loadingLabel

Description

This is an accessible name for the loading state's spinner. The default text is "Loading".

Typestring

render

Required
Description

Render function for child rows. Render props will contain an item from the items prop above.

Type(args: Item & { children?: Item[]; content?: Content; }) => ReactElement<RowProps<Item>, string | JSXElementConstructor<any>>

Row props

children

Description

Children contained in the row. Should be one or more cell components.

Typestring | number | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal

collapseLabel

Description

This is the accessible name for the collapse chevron button, used to tell assistive technology what the button is for.

Typestring

data

Description

Data to render. Passed down by item and passed into onExpand and onCollapse callbacks. This is normally set by the parent item component, and doesn't need to be configured.

TypeItem

depth

Description

The depth used for rendering an indent. This is normally set by parent item component, and doesn't need to be configured.

Typenumber

expandLabel

Description

This is the accessible name for the expand chevron button, used to tell assistive technology what the button is for.

Typestring

hasChildren

Description

Whether the row has children.

Typeboolean

isDefaultExpanded

Description

Sets the default expanded state of the row.

Typeboolean

isExpanded

Description

Controls the expanded state of the row.

Typeboolean

itemId

Description

ID for the row item.

Typestring

items

Description

The data used to render the row and descendants. Pass down from children render prop.

In addition to these props, any other data can be added to the object, and it will
be provided as props when rendering each cell.
TypeItem[]

mainColumnForExpandCollapseLabel

Description

Adds detail to the expand and collapse row button's aria label by appending the value from the given column. If you don't set this prop, the aria label will read out "Expand itemId row".

Should be a string when we pass data via `items` property in the table tree. The value should be one of the property `columns` names in the table tree.

Should be a number  when we pass data via the `Rows` component as children in the table tree.
Typestring | number

onCollapse

Description

Callback called when the row collapses.

Type(data: Item, analytics?: UIAnalyticsEvent) => void | Promise<void>

onExpand

Description

Callback called when the row expands.

Type(data: Item, analytics?: UIAnalyticsEvent) => void | Promise<void>

renderChildren

Description

Children to render under the row. This is normally set by the parent item component, and doesn't need to be configured.

Type() => ReactNode

shouldExpandOnClick

Description

Use this to set whether a row with children should expand when clicked anywhere within the row. If false or unset, a row with children will only expand when the chevron is clicked.

If your cells contain interactive elements, always set this to `false` to avoid unexpected expanding or collapsing.
Typeboolean

Cell props

children

Description

Children content, used when composing a table tree from internal components

Typestring | number | boolean | React.ReactElement<any, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | React.ReactPortal

className

Description

Class name to apply to the cell.

Typestring

columnIndex

Description
No description.
Typenumber

indentLevel

Description

Sets the indent level for the cell. Each indent level adds 25px to the left padding.

Typenumber

singleLine

Description

Sets whether the cell contents should wrap or display on a single line and be truncated. For accessibility reasons, wrapping the content is strongly recommended.

Typeboolean

width

Description

The width of the header item. Takes a string, or a number representing the width in pixels.

Typestring | number
Was this page helpful?
We use this feedback to improve our documentation.
© 2026 AtlassianTrademark, (opens new window)Privacy, (opens new window)License