Table
Tables are an efficient way of displaying sets of repeating data with the same structure.
Component Type
Container
Platform
Web
Component
Sana Canvas
Delivery Channels
Web, Web Mobile
Version
16.1.7Experience Surfaces
Page Body Inline
Anatomy - Tables

- Table Header (Optional): May consist of a header, result count, optional subheading, or any custom configuration of text.
- Table Outline (Optional): A border is used by default, but may be omitted for a full page table or in cases where a table is the sole element on a page.
- Column Header: Include just column labels by default, but icon actions for actions such as sort and filter may be added. Note that this functionality will be a custom add for developers.
- Cell: May consist of text, icons, status indicators, buttons, data types, or other custom content. Text overflows by default, but teams may elect to apply truncation with a tooltip.
Usage Guidance
Data Tables are intended to display data that can be easily scanned and compared.
- Conceptually, each row in a Table represents an item, and each cell of that row is an attribute of that item.
- This means that all the cells in a particular column will be the same data type such as dates, numerals, text, etc.
- Ideally, there should be one value per cell. Field sets are discouraged.
- Nested Tables are highly discouraged.
When to Use
Use tables to allow users to:
- Easily scan and compare data
- View and edit data
- Manipulate and navigate through a large amount of data
- Preview data
When to Use Something Else
Consider another component when:
- You only have a small data set.
- A more detailed amount of information needs to be displayed by default.
- There is more than one piece of information within a cell.
Design Annotations for Accessibility
- Specify the column header for every column
- Specify the row headers, if applicable
- Specify the caption of the table
Do’s and Don’ts

Do
Right align numeric data in tables.

Do
Right align actions in tables.

Do
Allow cell text to wrap where possible, giving users access to the full contents of the cell by default.

Do
We recommend wrapping text where possible, but if needed, cell text may be truncated, showing full text in a tooltip on hover.
Examples
Basic Example
Users may not want to use a caption so they can import
Heading or
Text instead. This
will give the user more flexibility around the customization of the title/heading of their table.
Pizza Toppings
| Toppings | Amount |
|---|---|
| Pepperoni | 2.5 oz |
| Mozzarella | 5 oz |
| Basil | 10 Leaves |
import {useUniqueId} from '@workday/canvas-kit-react/common';
import {Table} from '@workday/canvas-kit-react/table';
import {Heading} from '@workday/canvas-kit-react/text';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const styleOverrides = {
parentContainerStyles: createStyles({
marginBlockEnd: system.gap.md,
}),
tableHeaderStyles: createStyles({
backgroundColor: system.color.surface.raised,
}),
};
export default () => {
const headingID = useUniqueId();
return (
<>
<Heading as="h3" id={headingID} size="small" cs={styleOverrides.parentContainerStyles}>
Pizza Toppings
</Heading>
<Table aria-labelledby={headingID}>
<Table.Head>
<Table.Row>
<Table.Header scope="col" cs={styleOverrides.tableHeaderStyles}>
Toppings
</Table.Header>
<Table.Header scope="col" cs={styleOverrides.tableHeaderStyles}>
Amount
</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>Pepperoni</Table.Cell>
<Table.Cell>2.5 oz</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Mozzarella</Table.Cell>
<Table.Cell>5 oz</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Basil</Table.Cell>
<Table.Cell>10 Leaves</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
</>
);
};
Right to Left
Table supports right-to-left languages when specified in the CanvasProvider theme.
| מַשׁקֶה | גודל |
|---|---|
| אספרסו | 1 גר |
| מקיאטו | 2 גרם אספרסו |
| גזירה | 2 גרם אספרסו, 1 גרם חלב מוקצף |
import {CanvasProvider} from '@workday/canvas-kit-react/common';
import {Table} from '@workday/canvas-kit-react/table';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const tableHeaderStyles = createStyles({
backgroundColor: system.color.surface.raised,
});
export default () => {
return (
<CanvasProvider dir="rtl">
<Table>
<Table.Caption>משקאות קפה וגדלים</Table.Caption>
<Table.Head>
<Table.Row>
<Table.Header scope="col" cs={tableHeaderStyles}>
מַשׁקֶה
</Table.Header>
<Table.Header scope="col" cs={tableHeaderStyles}>
גודל
</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>אספרסו</Table.Cell>
<Table.Cell>1 גר</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>מקיאטו</Table.Cell>
<Table.Cell>2 גרם אספרסו</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>גזירה</Table.Cell>
<Table.Cell>2 גרם אספרסו, 1 גרם חלב מוקצף</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
</CanvasProvider>
);
};
Example with Caption
Users are free to use a caption instead of a heading. A caption is not required but it is good
for
accessibility
purposes.
| Drink | Size |
|---|---|
| Espresso | 1 oz |
| Macchiato | 2 oz Espresso |
| Cortado | 2 oz Espresso, 1 oz Foamed Milk |
| Cappuccino | 2 oz Espresso, 2 oz Foamed Milk, 2 oz Steamed Milk |
import {Table} from '@workday/canvas-kit-react/table';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const tableHeaderStyles = createStyles({
backgroundColor: system.color.surface.default,
});
export default () => {
return (
<Table>
<Table.Caption>Coffee Drinks and Sizes</Table.Caption>
<Table.Head>
<Table.Row>
<Table.Header scope="col" cs={tableHeaderStyles}>
Drink
</Table.Header>
<Table.Header scope="col" cs={tableHeaderStyles}>
Size
</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>Espresso</Table.Cell>
<Table.Cell>1 oz</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Macchiato</Table.Cell>
<Table.Cell>2 oz Espresso</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Cortado</Table.Cell>
<Table.Cell>2 oz Espresso, 1 oz Foamed Milk</Table.Cell>
</Table.Row>
<Table.Row></Table.Row>
<Table.Row>
<Table.Cell>Cappuccino</Table.Cell>
<Table.Cell>2 oz Espresso, 2 oz Foamed Milk, 2 oz Steamed Milk</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
);
};
Fixed Column
Users may add styles to the Table.Header to render a fixed column. The example below assigns a
width to the Table to guarantee the fixed column is triggered, but you are free to omit the
width if you would only like the fixed column to be triggered if necessary.
Performance Car Specs
| Make | Model | Year | Price | Engine | Transmission | Horsepower | Torque | Curb Weight |
|---|---|---|---|---|---|---|---|---|
| Porsche | 992 911 GT3 | 2022 | Starts at $160,000 | 4.0L Flat 6 | PDK or 7-Speed Manual | 502hp | 346 lb-ft | 3,164 lbs |
| BMW | M5 Competition | 2018 | Starts at $105,000 | Twin-Turbo 4.4L V8 | Automatic | 627hp | 553 lb-ft | 4,345 lbs |
| Alfa Romeo | 1750 GTV | 1970 | $30,000 - $55,000 | 1.75L Inline 4 | Manual | 122hp | 137 lb-ft | 2,140 lbs |
| Lotus | Emira | 2023 | Starts at $78,000 | Supercharged 3.5L V6 | Automatic or 6-Speed Manual | 400hp | 317 lb-ft | 3520 lbs |
| Toyota | Supra | 1998 | $40,000 - $80,000 | 3.0L Inline 6 | Automatic or 6-Speed Manual | 320hp | 315 lb-ft | 3,599 lbs |
| Nissan | Skyline GT-R | 1994 | $45,000 - $90,000 | 2.6L Twin-Turbo Inline 6 | 5-Speed Manual | 276hp | 260 lb-ft | 3,153 lbs |
import React from 'react';
import {useUniqueId} from '@workday/canvas-kit-react/common';
import {Table} from '@workday/canvas-kit-react/table';
import {Heading} from '@workday/canvas-kit-react/text';
import {createStyles, px2rem} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const styleOverrides = {
parentContainerStyles: createStyles({
marginBlockEnd: system.gap.md,
}),
tableStyles: createStyles({
width: px2rem(690),
}),
tableHeaderStyles: createStyles({
position: 'sticky',
left: '0',
backgroundColor: system.color.surface.raised,
borderInlineEnd: `${px2rem(2)} solid ${system.color.border.default}`,
}),
};
export default () => {
const headingID = useUniqueId();
const exampleData = [
{
make: 'Porsche',
model: '992 911 GT3',
year: '2022',
price: 'Starts at $160,000',
engine: '4.0L Flat 6',
transmission: 'PDK or 7-Speed Manual',
horsepower: '502hp',
torque: '346 lb-ft',
curbWeight: '3,164 lbs',
},
{
make: 'BMW',
model: 'M5 Competition',
year: '2018',
price: 'Starts at $105,000',
engine: 'Twin-Turbo 4.4L V8',
transmission: 'Automatic',
horsepower: '627hp',
torque: '553 lb-ft',
curbWeight: '4,345 lbs',
},
{
make: 'Alfa Romeo',
model: '1750 GTV',
year: '1970',
price: '$30,000 - $55,000',
engine: '1.75L Inline 4',
transmission: 'Manual',
horsepower: '122hp',
torque: '137 lb-ft',
curbWeight: '2,140 lbs',
},
{
make: 'Lotus',
model: 'Emira',
year: '2023',
price: 'Starts at $78,000',
engine: 'Supercharged 3.5L V6',
transmission: 'Automatic or 6-Speed Manual',
horsepower: '400hp',
torque: '317 lb-ft',
curbWeight: '3520 lbs',
},
{
make: 'Toyota',
model: 'Supra',
year: '1998',
price: '$40,000 - $80,000',
engine: '3.0L Inline 6',
transmission: 'Automatic or 6-Speed Manual',
horsepower: '320hp',
torque: '315 lb-ft',
curbWeight: '3,599 lbs',
},
{
make: 'Nissan',
model: 'Skyline GT-R',
year: '1994',
price: '$45,000 - $90,000',
engine: '2.6L Twin-Turbo Inline 6',
transmission: '5-Speed Manual',
horsepower: '276hp',
torque: '260 lb-ft',
curbWeight: '3,153 lbs',
},
];
return (
<>
<Heading as="h3" id={headingID} size="small" cs={styleOverrides.parentContainerStyles}>
Performance Car Specs
</Heading>
<Table cs={styleOverrides.tableStyles} aria-labelledby={headingID} tabIndex={0}>
<Table.Head>
<Table.Row>
<Table.Header scope="col" cs={styleOverrides.tableHeaderStyles}>
Make
</Table.Header>
<Table.Header scope="col">Model</Table.Header>
<Table.Header scope="col">Year</Table.Header>
<Table.Header scope="col">Price</Table.Header>
<Table.Header scope="col">Engine</Table.Header>
<Table.Header scope="col">Transmission</Table.Header>
<Table.Header scope="col">Horsepower</Table.Header>
<Table.Header scope="col">Torque</Table.Header>
<Table.Header scope="col">Curb Weight</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
{exampleData.map((item, index) => (
<React.Fragment key={index}>
<Table.Row>
<Table.Header scope="row" cs={styleOverrides.tableHeaderStyles}>
{item.make}
</Table.Header>
<Table.Cell>{item.model}</Table.Cell>
<Table.Cell>{item.year}</Table.Cell>
<Table.Cell>{item.price}</Table.Cell>
<Table.Cell>{item.engine}</Table.Cell>
<Table.Cell>{item.transmission}</Table.Cell>
<Table.Cell>{item.horsepower}</Table.Cell>
<Table.Cell>{item.torque}</Table.Cell>
<Table.Cell>{item.curbWeight}</Table.Cell>
</Table.Row>
</React.Fragment>
))}
</Table.Body>
</Table>
</>
);
};
Base Html Table Example
If a user needs a standard HTML
table with no
CSS Grid features, then they can
use the BaseTable component.
| Drink | Size |
|---|---|
| Espresso | 1 oz |
| Macchiato | 2 oz Espresso |
| Cortado | 2 oz Espresso, 1 oz Foamed Milk |
| Cappuccino | 2 oz Espresso, 2 oz Foamed Milk, 2 oz Steamed Milk |
import {BaseTable} from '@workday/canvas-kit-react/table';
import {createStyles} from '@workday/canvas-kit-styling';
import {system} from '@workday/canvas-tokens-web';
const tableHeaderStyles = createStyles({
backgroundColor: system.color.surface.raised,
});
export default () => {
return (
<BaseTable>
<BaseTable.Caption>Coffee Drinks and Sizes</BaseTable.Caption>
<BaseTable.Head>
<BaseTable.Row>
<BaseTable.Header scope="col" cs={tableHeaderStyles}>
Drink
</BaseTable.Header>
<BaseTable.Header scope="col" cs={tableHeaderStyles}>
Size
</BaseTable.Header>
</BaseTable.Row>
</BaseTable.Head>
<BaseTable.Body>
<BaseTable.Row>
<BaseTable.Cell>Espresso</BaseTable.Cell>
<BaseTable.Cell>1 oz</BaseTable.Cell>
</BaseTable.Row>
<BaseTable.Row>
<BaseTable.Cell>Macchiato</BaseTable.Cell>
<BaseTable.Cell>2 oz Espresso</BaseTable.Cell>
</BaseTable.Row>
<BaseTable.Row>
<BaseTable.Cell>Cortado</BaseTable.Cell>
<BaseTable.Cell>2 oz Espresso, 1 oz Foamed Milk</BaseTable.Cell>
</BaseTable.Row>
<BaseTable.Row></BaseTable.Row>
<BaseTable.Row>
<BaseTable.Cell>Cappuccino</BaseTable.Cell>
<BaseTable.Cell>2 oz Espresso, 2 oz Foamed Milk, 2 oz Steamed Milk</BaseTable.Cell>
</BaseTable.Row>
</BaseTable.Body>
</BaseTable>
);
};
Which Component Should I Use?
If a user wants CSS Grid features with their Table, then use the Table component.
If a user does not want CSS Grid features with their Table, then use the BaseTable component.
Advanced
You can also find several advanced Table examples in our Guides > Accessibility > Table Patterns section.
- Expandable Rows
- Nested Rows
- Selectable Rows
- Filterable Column Headers
- Sortable Column Headers
- With Form Fields
Custom Styles
Table and its subcomponents support custom styling via the cs prop. For more information, check
our
“How To Customize Styles” .
Accessibility
Table is a styled compound wrapper around native HTML table elements (<table>, <caption>,
<thead>, <tbody>, <tfoot>, <tr>, <th>, <td>). Assistive technology can announce column
and row headers as users move through cells only when the markup is a real data table with
correct headers and an accessible name. Table does not include a model, roving tabindex, or
built-in sort, filter, selection, or expand behavior.
Use Table for tabular data with a relationship between rows and columns—not for page layout.
Prefer Table (CSS Grid) unless the design needs a standard HTML table layout without Grid;
then use BaseTable. The same accessibility requirements apply to both. For interactive table
patterns, follow
Guides > Accessibility > Table Patterns
instead of inventing ARIA. See also
Table Pattern | APG | WAI | W3C .
Minimum accessible structure
The following matches the Example with Caption (Basic story): native
table markup with Table.Caption as the accessible name and scope="col" on column
headers. The Basic Example uses a visible Heading and aria-labelledby
instead of a caption; that is an equally valid naming pattern (see Accessibility Requirements).
import {Table} from '@workday/canvas-kit-react/table';
<Table>
<Table.Caption>Coffee Drinks and Sizes</Table.Caption>
<Table.Head>
<Table.Row>
<Table.Header scope="col">Drink</Table.Header>
<Table.Header scope="col">Size</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Cell>Espresso</Table.Cell>
<Table.Cell>1 oz</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Cell>Macchiato</Table.Cell>
<Table.Cell>2 oz Espresso</Table.Cell>
</Table.Row>
</Table.Body>
</Table>;Put Table.Caption first when you use it (HTML requires <caption> as the first child of
<table>). Pair every column header with scope="col". Do not render empty Table.Row
elements.
Built-in Behaviors
Canvas Kit applies these automatically when you compose Table (or BaseTable) with its
subcomponents. Do not duplicate them in consuming code.
Native table semantics (applied by createComponent element mapping):
Table:<table>Table.Caption:<caption>Table.Head:<thead>Table.Body:<tbody>Table.Footer:<tfoot>Table.Row:<tr>(Table.Rowalso sets CSS Grid column tracks from the count of valid child cells; this is layout only)Table.Header:<th>Table.Cell:<td>
Keyboard (standard Table behavior):
Table uses native <table> keyboard behavior. Do not add custom key handlers or grid-widget keys
on a data table.
When Table overflows (the root stencil uses overflow: auto), add tabIndex={0} so
keyboard users can focus and scroll it, as in the Fixed Column example. Omit
tabIndex when the table does not scroll.
Screen reader expectations (when built-in behaviors are used as intended):
- The table is announced as a table, with its accessible name from
Table.Captionoraria-labelledby/aria-labelonTable - Moving across a row announces the column header (
scope="col") - Moving down a column announces the row header when body cells use
Table.Headerwithscope="row" - Interactive controls inside cells are announced with their own name and role when focused
Accessibility Requirements
Required in application code for an accessible Table. There is no useTableModel. Canvas Kit
does not set scope, an accessible name, tabIndex, or id / headers cell associations —
supply those in application code when the table below requires them. Rows marked (conditional)
apply only when the situation matches—otherwise omit.
If no design spec is provided: generate a simple data table with Table.Caption,
Table.Head / Table.Body, scope="col" on column headers, and Table.Cell for
body data. Omit Table.Footer, row headers, tabIndex, id / headers associations,
aria-sort, aria-expanded, aria-level, selection checkboxes, and filter/sort popups
unless the spec calls for those patterns.
Heading instead of caption (conditional):
When the design uses a visible heading (or other text) instead of Table.Caption, give that
heading a unique id and set aria-labelledby on Table. Do not also render
Table.Caption unless the design needs both a caption and extra labelling. See
Basic Example.
<Heading as="h3" id={headingId}>
Pizza Toppings
</Heading>
<Table aria-labelledby={headingId}>{/* … */}</Table>Interactive and advanced patterns (conditional):
Do not invent table ARIA. Copy the matching Canvas Kit guide when the spec includes that behavior:
- Expandable Rows
- Nested Rows
- Selectable Rows
- Filterable Column Headers
- Sortable Column Headers
- With Form Fields
| Requirement | How to satisfy |
|---|---|
| Data table, not layout | Compose Table (or BaseTable) with Head, Body, Row, Header, and Cell. Do not use a table to position non-tabular UI. |
| Accessible name | Table.Caption with a descriptive title, or aria-labelledby on Table pointing at a visible heading id (see Heading instead of caption). Canvas Kit does not set aria-labelledby. |
| Column headers | Set scope="col" on every Table.Header in Table.Head. Table.Header renders <th> but does not set scope. Do not use Table.Cell (<td>) for column headers. |
| Row headers (conditional) | When the first (or identifying) column names each row, set scope="row" on Table.Header in the body, as in Fixed Column. Do not rely on <th> alone. |
| Keyboard access to overflow (conditional) | If the table scrolls, set tabIndex={0} on Table. Omit it when content does not overflow. |
| Footer (conditional) | Table.Footer only when the design includes summary or footer rows. |
| Form controls in cells (conditional) | Label every control (prefer FormField). See With Form Fields and Form Field. |
| Sort, filter, select, expand, or nest (conditional) | Follow the matching Table Patterns guide. Ask the developer which pattern the spec requires before generating aria-sort, aria-expanded, aria-level, aria-owns, live regions, or selection checkboxes. |
Summary for code generation:
- REQUIRED: semantic
Tablecomposition, accessible name (caption oraria-labelledby),scope="col"on column headers - CONDITIONAL: heading +
aria-labelledby,scope="row",tabIndex={0}for overflow,Table.Footer, form-field labelling in cells, advanced table patterns from the guides
Anti-Patterns
Do not generate code that does the following (see Accessibility Requirements above for what to supply instead):
- Manually set
role="table",role="row",role="columnheader",role="rowheader", orrole="cell"onTablesubcomponents — they already render native table elements - Omit
scopeonTable.Header, or useTable.Cellfor column or row headers - Generate
id/headersassociations on cells for a simple data table — usescopeinstead (see Accessibility Requirements) - Leave the table unnamed (no
Table.Caption,aria-labelledby, oraria-label), or setaria-labelledbywhenTable.Captionalready names the table - Use a table for page layout
- Add
tabIndex={0}on a table that does not scroll, or omit it on a horizontally/vertically scrollable table - Set
aria-sort,aria-expanded,aria-level,aria-owns, or selection checkboxes by default — those belong to specific Table Patterns and need a matching design spec - Nest a
<table>inside a cell to fake hierarchy, or add extraTable.Bodyelements to fake a tree — see Nested Rows - Put a “Select All” checkbox in a column header
Table.Headerwithout following Selectable Rows - Place unlabeled inputs in cells, or rely on the column header alone without checking With Form Fields
- Generate
role="grid"/ grid-widget keyboard behavior onTable— CSS Grid onTable.Rowis visual layout, not an ARIA grid
Component API
Table
Table is a simple styled compound component that renders a table element. It is used to present information in a two-dimensional table comprised of rows and columns of cells containing data.
Table is built off of BaseTable and is using CSS Grid features.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Caption>Table Caption</Table.Caption>
<Table.Head>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Header>Table Header</Table.Header>
</Table.Row>
</Table.Head>
<Table.Body>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Header>Table Header</Table.Header>
</Table.Row>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Data Cell</Table.Cell>
</Table.Row>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Data Cell</Table.Cell>
</Table.Row>
</Table.Body>
<Table.Footer>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Data Cell</Table.Cell>
</Table.Row>
</Table.Footer>
</Table>
);
}
Layout Component
Table supports all props from thelayout component.
Props
Props extend from table. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | table |
ref | React.Ref<R = table> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Caption
Table.Caption renders a caption element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Caption>Table Caption</Table.Caption>
<Table.Body>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
);
}
Layout Component
Table.Caption supports all props from thelayout component.
Props
Props extend from caption. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | caption |
ref | React.Ref<R = caption> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Head
Table.Head renders a thead element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Head>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Head>
</Table>
);
}
Layout Component
Table.Head supports all props from thelayout component.
Props
Props extend from thead. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | thead |
ref | React.Ref<R = thead> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Body
Table.Body renders a tbody element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Body>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
);
}
Layout Component
Table.Body supports all props from thelayout component.
Props
Props extend from tbody. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | tbody |
ref | React.Ref<R = tbody> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Row
Table.Row renders a tr element.
Note: Table.Row is built on Grid. It will look for
how many children are there and if those children are valid React Elements. This will adjust the
amount of columns automatically using the gridTemplateColumns style prop and the width of the
columns is also set using a minmax function in the gridTemplateColumns style prop. If a user
would like to adjust this, it can be overwritten on Table.Row. See the example below for how to
overwrite gridTemplateColumns.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Head>
<Table.Row gridTemplateColumns="repeat(4, minmax(100px, 1fr))">
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Head>
</Table>
);
}
Layout Component
Table.Row supports all props from thelayout component.
Props
Props extend from tr. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | tr |
ref | React.Ref<R = tr> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Header
Table.Header renders a th element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Head>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Head>
</Table>
);
}
Layout Component
Table.Header supports all props from thelayout component.
Props
Props extend from th. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | th |
ref | React.Ref<R = th> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Cell
Table.Cell renders a td element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Body>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Body>
</Table>
);
}
Layout Component
Table.Cell supports all props from thelayout component.
Props
Props extend from td. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | td |
ref | React.Ref<R = td> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |
Table.Footer
Table.Footer renders a tfoot element.
import {Table} from '@workday/canvas-kit-react/table';
export default function App() {
return (
<Table>
<Table.Footer>
<Table.Row>
<Table.Header>Table Header</Table.Header>
<Table.Cell>Table Cell</Table.Cell>
</Table.Row>
</Table.Footer>
</Table>
);
}
Layout Component
Table.Footer supports all props from thelayout component.
Props
Props extend from tfoot. Changing the as prop will change the element interface.
| Name | Type | Description | Default |
|---|---|---|---|
cs | | The | |
children | ReactNode | ||
as | React.ElementType | Optional override of the default element used by the component. Any valid tag or Component. If you provided a Component, this component should forward the ref using Note: Not all elements make sense and some elements may cause accessibility issues. Change this value with care. | tfoot |
ref | React.Ref<R = tfoot> | Optional ref. If the component represents an element, this ref will be a reference to the real DOM element of the component. If |