Concepts
OverviewCompositionTestingLayout
Aspect RatioBleedBoxCenterContainerDividerFlexFloatGridLink OverlayScrollableStackWrapComponents
AccordionAdmonitionAvatarButtonCheckboxComboboxConfirm ModalCTAModalDate PickerDialogFieldFieldsetFile UploaderIcon ButtonInputLoading StatesMenuNotificationsProgressPrompt ModalRadioRatingSelectSwitchTableTabsTagTextTextareaToggleTooltipUtilities
Feature FlagsForLocal StoragePortalShowsplitPropsThemeTable
The Table component is a controlled component that can be used to display tabular data.
1import { Table } from '@cerberus/react'
Usage
The Table component is a controlled component that can be used to display tabular data. It can be used in a group with other tables to allow for multiple selections.
Product | Category | Price |
---|---|---|
Laptop | Electronics | 999.99 |
Coffee Maker | Home Appliances | 49.99 |
Desk Chair | Furniture | 150 |
Smartphone | Electronics | 799.99 |
Headphones | Accessories | 199.99 |
Sizes
The Table.Root
component supports different sizes for its cells. You can set the size of the table using the size
prop. The available sizes are sm
, md
, and lg
. The default size is md
.
Small |
---|
Small |
Medium |
---|
Medium |
Large |
---|
Large |
Decoration
The Table.Root
component supports different decorations for its rows. You can set the decoration of the table using the decoration
prop. The available decorations are default
and zebra
.
Default |
---|
one |
two |
three |
Zebra |
---|
one |
two |
three |
Sticky
The Table.Root
component supports a sticky
prop, which makes the table header sticky. This is useful for long tables where you want to keep the header visible while scrolling.
Product | Category | Price |
---|---|---|
Laptop | Electronics | 999.99 |
Coffee Maker | Home Appliances | 49.99 |
Desk Chair | Furniture | 150 |
Smartphone | Electronics | 799.99 |
Headphones | Accessories | 199.99 |
Clickable
The Table.HeaderCol
component supports a Table.Trigger
, which renders a button element. This allows you to create clickable headers for sorting or other actions.
Name | |
---|---|
Jane Doe | 25 |
John Doe | 30 |
Primitives
You can utilize the primitive components or the css
prop to customize the table.
Component | Description |
---|---|
TableRoot | The table container component. |
TableEl | The table component. |
Caption | The caption component. |
Thead | The table header component. |
Th | The table header cell component. |
Tbody | The table body component. |
Tr | The table row component. |
Td | The table cell component. |
Tfoot | The table footer component. |
TableTrigger | The table trigger component. |
Cerberus Family | Alias |
---|---|
Cerberus | The Three-Headed Dog |
Hades | God of the Underworld |
Persephone | Queen of the Underworld |
Charon | The Ferryman |
Cerberus | The Guardian of the Underworld |
Thanatos | God of Death |
API
Props
The Table
component is an abstraction of the primitives and accepts the following props:
Name | Default | Description |
---|---|---|
caption | The accessible caption of the Table. | |
size | md | This cell size of the Table. |
decoration | default | The decoration of the Table. |
sticky | false | If true, the table header will be sticky. |
Table component parts
The Table
API is an Object containing the full family of abstracted components.
Name | Description |
---|---|
Root | An abstraction of the TableRoot , TableEl , and Caption . |
Header | The table header component. |
HeaderCol | The table header cell component. |
Body | The table body component. |
Row | The table row component. |
Cell | The table cell component. |
Footer | The table footer component. |
Trigger | The optional table header col trigger component. |
Parts
The TableParts
API is an Object containing the full family of components.
Name | Description |
---|---|
Root | The TableRoot component which is the container of the table. |
Table | The TableEl component which is the table element. |
Caption | The Caption component which is the caption of the table. |
Header | The Thead component which is the table header component. |
HeaderCol | The Th component which is the table header cell component. |
Body | The Tbody component which is the table body component. |
Row | The Tr component which is the table row component. |
Cell | The Td component which is the table cell component. |
Footer | The Tfoot component which is the table footer component. |
Trigger | The TableTrigger component which is the optional table header col trigger component. |
On this page