DocsBlog

Get Started

Components

Data Grid

Signals

Styling

Theming

↑↓Navigate
↵Select
EscClose
  • 1.8.0

  • Day

    Night

    Preview

    Switch mode
  • cerberus

    acheron

    elysium

    oceanus

Get Started
Components
Data Grid
Signals
Styling
Theming

Concepts

OverviewCompositionCerberus ContextTesting

Layout

Aspect RatioBleedBoxCenterContainerContainer QueryDividerFlexFloatGridGroupLink OverlayScrollableStackWrap

Components

AccordionAdmonitionAvatarButtonCarouselCheckboxClipboardCollapsibleComboboxConfirm ModalCTA ModalDate PickerDialogFieldFieldsetFile UploaderIconButtonInputLoading StatesMarqueeMenuNotificationsNumber InputPaginationPin InputPopoverProgress IndicatorsPrompt ModalRadioRatingSelectSliderSplit ButtonSwitchTableTabsTagTextTextareaToggleTooltip

Utilities

Client OnlyDownload TriggerEnvironmentFeature FlagsFocus TrapForFormat ByteFormat NumberFormat Relative TimeFormat Relative TimeFrameHighlightJSON Tree ViewLocalePortalPresenceShowSwapsplitPropsTheme

Table

The Table component is a controlled component that can be used to display tabular data.

  • npm
  • source
  • recipe
View as Markdown
Open this page in Markdown
Anthropic
Open in Claude
Ask questions about this page
OpenAI
Open in ChatGPT
Ask questions about this page

Import

import { Table } from '@cerberus/react'

Usage

The Table component is a controlled component that can be used to display data. It can be used in a group with other tables to allow for multiple selections.

Note

Want a high-end feature packed solution? Check out the Data Grid, the Cerberus superpowered table component.

Loading example...

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.

Loading example...

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.

Loading example...

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.

Note

The sticky prop removes the border from the table so you can provide it on the scrollable container for a better design experience.

Loading example...

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.

Loading example...

Customizing

To customize the table use style props or the Primtives

Loading example...

Primitives

You can utilize the primitive components or the css prop to customize the table.

ComponentDescription
TableRootThe table container component.
TableElThe table component.
CaptionThe caption component.
TheadThe table header component.
ThThe table header cell component.
TbodyThe table body component.
TrThe table row component.
TdThe table cell component.
TfootThe table footer component.
TableTriggerThe table trigger component.

Parts

The TableParts API is an Object containing the full family of components.

NameDescription
RootThe TableRoot component which is the container of the table.
TableThe TableEl component which is the table element.
CaptionThe Caption component which is the caption of the table.
HeaderThe Thead component which is the table header component.
HeaderColThe Th component which is the table header cell component.
BodyThe Tbody component which is the table body component.
RowThe Tr component which is the table row component.
CellThe Td component which is the table cell component.
FooterThe Tfoot component which is the table footer component.
TriggerThe TableTrigger component which is the optional table header col trigger component.

API

Props

The Table component is an abstraction of the primitives and accepts the following props:

NameDefaultDescription
captionThe accessible caption of the Table.
sizemdThis cell size of the Table.
decorationdefaultThe decoration of the Table.
stickyfalseIf true, the table header will be sticky.

On this page

  • Import
  • Usage
  • Sizes
  • Decoration
  • Sticky
  • Clickable
  • Customizing
  • Primitives
    • Parts
  • API
    • Props
Edit this page on Github
Basic table example
ProductCategoryPrice
LaptopElectronics999.99
Coffee MakerHome Appliances49.99
Desk ChairFurniture150
SmartphoneElectronics799.99
HeadphonesAccessories199.99
Table using the sm size
sm
sm
Table using the md size
md
md
Table using the lg size
lg
lg
Table using the default decoration
DecorationCount
default1
default2
default3
Table using the zebra decoration
DecorationCount
zebra1
zebra2
zebra3
Better find a mop, it's getting sticky...
ProductCategoryPrice
LaptopElectronics999.99
Coffee MakerHome Appliances49.99
Desk ChairFurniture150
SmartphoneElectronics799.99
HeadphonesAccessories199.99
Clickable table
Name
Jane Doe25
John Doe30
Customized table
Cerberus FamilyAlias
CerberusThe Three-Headed Dog
HadesGod of the Underworld
PersephoneQueen of the Underworld
CharonThe Ferryman
CerberusThe Guardian of the Underworld
ThanatosGod of Death