Skip to main content

Table

Table component is used to organize and display data efficiently. It renders a <table> element by default'

Import

import {
Table,
Thead,
Tbody,
Tfoot,
Tr,
Th,
Td,
TableCaption,
TableContainer,
} from '@chakra-ui/react';

Table Container

The table container component renders a div that wraps the table component to not allow the table to overflow the parent container, not allow data content to break lines without exception, and enable horizontal scrolling.

It renders the following props:

PropertyValue
displayblock
maxWidth100%
overflowXauto
overflowYhidden
whiteSpacenowrap

It can optionally accept the overflow or overflowX props to override the overflowX default value of auto rendered by this component.

This component will be shown on all examples in this page. View the examples in mobile to see the effects.

Table Variants

The table component comes in 3 variants: simple, striped, and unstyled. The default variant is simple

Change the variant values to see the other variants.

Simple Table

Striped Table

Table Sizing

The table component is available in 3 sizes: sm, md, lg. The default size is md.

Props

Table

colorScheme

Type
"whiteAlpha" | "blackAlpha" | "gray" | "red" | "orange" | "yellow" | "green" | "teal" | "blue" | "cyan" | "purple" | "pink" | "linkedin" | "facebook" | "messenger" | "whatsapp" | "twitter" | "telegram"
Default
"gray"

size

Type
"sm" | "md" | "lg"
Default
"md"

variant

Type
"simple" | "striped" | "unstyled"
Default
"simple"

Td

isNumeric

Description

Aligns the cell content to the right

Type
boolean

Th

isNumeric

Description

Aligns the cell content to the right

Type
boolean

TableCaption

placement

Description

The placement of the table caption. This sets the `caption-side` CSS attribute.

Type
"top" | "bottom"
Default
"bottom"