stringTable
Tables are used to organize and display data efficiently. It renders a <table>
element by default.
Chakra UI Pro: Start your application or marketing site with a growing collection of beautiful and responsive UI components.
Ads via Chakra UI
Import#
import {Table,Thead,Tbody,Tfoot,Tr,Th,Td,TableCaption,} from "@chakra-ui/react"
Table Variants#
The table component comes in 3 variants: simple, striped, and unstyled.
The default variant is simple
Change the
variantvalues to see the other variants.
Simple Table#
<Table variant="simple"><TableCaption>Imperial to metric conversion factors</TableCaption><Thead><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Thead><Tbody><Tr><Td>inches</Td><Td>millimetres (mm)</Td><Td isNumeric>25.4</Td></Tr><Tr><Td>feet</Td><Td>centimetres (cm)</Td><Td isNumeric>30.48</Td></Tr><Tr><Td>yards</Td><Td>metres (m)</Td><Td isNumeric>0.91444</Td></Tr></Tbody><Tfoot><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Tfoot></Table>
Striped Table#
<Table variant="striped" colorScheme="teal"><TableCaption>Imperial to metric conversion factors</TableCaption><Thead><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Thead><Tbody><Tr><Td>inches</Td><Td>millimetres (mm)</Td><Td isNumeric>25.4</Td></Tr><Tr><Td>feet</Td><Td>centimetres (cm)</Td><Td isNumeric>30.48</Td></Tr><Tr><Td>yards</Td><Td>metres (m)</Td><Td isNumeric>0.91444</Td></Tr></Tbody><Tfoot><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Tfoot></Table>
Table Sizing#
The table component is available in 3 sizes: sm, md, lg. The default size
is md.
<Table size="sm"><Thead><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Thead><Tbody><Tr><Td>inches</Td><Td>millimetres (mm)</Td><Td isNumeric>25.4</Td></Tr><Tr><Td>feet</Td><Td>centimetres (cm)</Td><Td isNumeric>30.48</Td></Tr><Tr><Td>yards</Td><Td>metres (m)</Td><Td isNumeric>0.91444</Td></Tr></Tbody><Tfoot><Tr><Th>To convert</Th><Th>into</Th><Th isNumeric>multiply by</Th></Tr></Tfoot></Table>
Props#
Table#
colorScheme
colorSchemeType
Default
"gray"size
sizeType
stringDefault
"md"variant
variantType
stringDefault
"simple"Td#
isNumeric
isNumericDescription
Aligns the cell content to the right
Type
booleanTh#
isNumeric
isNumericDescription
Aligns the cell content to the right
Type
booleanTableCaption#
placement
placementDescription
The placement of the table caption. This sets the `caption-side` CSS attribute.
Type
"top" | "bottom"Default
"bottom"