Skip to main content

Table

Display data clearly in rows and columns, helping users view, analyze, and compare information. Automatically renders as a list on small screens and a table on large ones.

boolean
Default: false

Whether there's an additional page of data.

boolean
Default: false

Whether there's a previous page of data.

boolean
Default: false

Whether the table is in a loading state, such as initial page load or loading the next page in a paginated table. When true, the table could be in an inert state, which prevents user interaction.

boolean
Default: false

Whether to use pagination controls.

"auto" | "list"
Default: 'auto'

Sets the layout of the Table.

  • list: The Table is always displayed as a list.
  • table: The Table is always displayed as a table.
  • auto: The Table is displayed as a table on wide devices and as a list on narrow devices.
Was this section helpful?

HTMLElement

The content of the Table.

HTMLElement

Additional filters to display in the table. For example, the s-search-field component can be used to filter the table data.

Was this section helpful?

Learn more about registering events.

<typeof tagName> | null
<typeof tagName> | null
Was this section helpful?

Define the main content area of a table, containing rows and cells that display data.

Was this section helpful?

HTMLElement

The body of the table. May not have any semantic meaning in the Table's list variant.

Was this section helpful?

Display data within a cell in a table row.

Was this section helpful?

HTMLElement

The content of the table cell.

Was this section helpful?

Display column names at the top of a table.

The format of the column. Will automatically apply styling and alignment to cell content based on the value.

  • base: The base format for columns.
  • currency: Formats the column as currency.
  • numeric: Formats the column as a number.
Default: 'labeled'

Content designation for the table's list variant.

  • primary: The most important content. Only one column can have this designation.
  • secondary: The secondary content. Only one column can have this designation.
  • kicker: Content that is displayed before primary and secondary content, but with less visual prominence. Only one column can have this designation.
  • inline: Content that is displayed inline.
  • labeled: Each column with this designation displays as a heading-content pair.
Was this section helpful?

HTMLElement

The heading of the column in the table variant, and the label of its data in list variant.

Was this section helpful?

Define a header row in a table, displaying column names and enabling sorting.

Was this section helpful?

HTMLElement

Contents of the table heading row; children should be TableHeading components.

Was this section helpful?

Display a row of data within the body of a table.

string

The ID of an interactive element (e.g. s-link) in the row that will be the target of the click when the row is clicked. This is the primary action for the row; it should not be used for secondary actions.

This is a click-only affordance, and does not introduce any keyboard or screen reader affordances. Which is why the target element must be in the table; so that keyboard and screen reader users can interact with it normally.

Was this section helpful?

HTMLElement

The content of a TableRow, which should be TableCell components.

Was this section helpful?

Code

<s-section padding="none">
<s-table>
<s-table-header-row>
<s-table-header>Name</s-table-header>
<s-table-header>Email</s-table-header>
<s-table-header>Phone</s-table-header>
</s-table-header-row>
<s-table-body>
<s-table-row>
<s-table-cell>John Doe</s-table-cell>
<s-table-cell>john.doe@example.com</s-table-cell>
<s-table-cell>123-456-7890</s-table-cell>
</s-table-row>
<s-table-row>
<s-table-cell>Jane Doe</s-table-cell>
<s-table-cell>jane.doe@example.com</s-table-cell>
<s-table-cell>123-456-7890</s-table-cell>
</s-table-row>
<s-table-row>
<s-table-cell>Brandon Doe</s-table-cell>
<s-table-cell>brandon.doe@example.com</s-table-cell>
<s-table-cell>123-456-7890</s-table-cell>
</s-table-row>
</s-table-body>
</s-table>
</s-section>

Component examples

Tables are full-width by default to utilize all available space for displaying data.

Demonstrates a table with pagination controls, showing how to add previous and next page functionality to handle large datasets.

Showcases the table's loading state, which can be used to indicate that data is being fetched or processed.

Anchor to example-full-width-table-with-multiple-columnsFull-width table with multiple columns

A comprehensive example showing a full-width table with multiple columns. Tables automatically expand to fill their container width.

Anchor to example-advanced-table-with-all-list-slot-typesAdvanced Table with All List Slot Types

A comprehensive example demonstrating different list slot types for various header and cell configurations, showing how to use kicker, primary, secondary, inline, and labeled slots.

Was this section helpful?

Basic Usage

<s-section padding="none">
<s-table>
<s-table-header-row>
<s-table-header listSlot="primary">Product</s-table-header>
<s-table-header listSlot="inline">Status</s-table-header>
<s-table-header listSlot="labeled">Inventory</s-table-header>
<s-table-header listSlot="labeled">Price</s-table-header>
</s-table-header-row>

<s-table-body>
<s-table-row>
<s-table-cell>Water bottle</s-table-cell>
<s-table-cell>
<s-badge tone="success">Active</s-badge>
</s-table-cell>
<s-table-cell>128</s-table-cell>
<s-table-cell>$24.99</s-table-cell>
</s-table-row>
<s-table-row>
<s-table-cell>T-shirt</s-table-cell>
<s-table-cell>
<s-badge tone="warning">Low stock</s-badge>
</s-table-cell>
<s-table-cell>15</s-table-cell>
<s-table-cell>$19.99</s-table-cell>
</s-table-row>
<s-table-row>
<s-table-cell>Cutting board</s-table-cell>
<s-table-cell>
<s-badge tone="critical">Out of stock</s-badge>
</s-table-cell>
<s-table-cell>0</s-table-cell>
<s-table-cell>$34.99</s-table-cell>
</s-table-row>
</s-table-body>
</s-table>
</s-section>