Skip to content

STable <s-table> ​

ts
import { STable } from 'polaris-vue-elements'

Example ​

OrderCustomerTotalStatus#1001Alex Morgan$120.00Fulfilled#1002Sam Rivera$45.50Pending#1003Jamie Lee$310.25Cancelled
vue
<script setup>
import {
  STable,
  STableHeaderRow,
  STableHeader,
  STableBody,
  STableRow,
  STableCell,
  SBadge,
} from 'polaris-vue-elements'
</script>

<template>
  <!-- STable is the root: it lays out the header row + body and can switch to a
       "list" layout on narrow devices when variant="auto". -->
  <STable variant="auto">
    <STableHeaderRow>
      <STableHeader listSlot="primary">Order</STableHeader>
      <STableHeader listSlot="secondary">Customer</STableHeader>
      <STableHeader format="currency">Total</STableHeader>
      <STableHeader>Status</STableHeader>
    </STableHeaderRow>
    <STableBody>
      <STableRow>
        <STableCell>#1001</STableCell>
        <STableCell>Alex Morgan</STableCell>
        <STableCell>$120.00</STableCell>
        <STableCell><SBadge tone="success">Fulfilled</SBadge></STableCell>
      </STableRow>
      <STableRow>
        <STableCell>#1002</STableCell>
        <STableCell>Sam Rivera</STableCell>
        <STableCell>$45.50</STableCell>
        <STableCell><SBadge tone="warning">Pending</SBadge></STableCell>
      </STableRow>
      <STableRow>
        <STableCell>#1003</STableCell>
        <STableCell>Jamie Lee</STableCell>
        <STableCell>$310.25</STableCell>
        <STableCell><SBadge tone="critical">Cancelled</SBadge></STableCell>
      </STableRow>
    </STableBody>
  </STable>
</template>

Props ​

PropTypeDescription
hasNextPagebooleanWhether there's an additional page of data.
hasPreviousPagebooleanWhether there's a previous page of data.
loadingbooleanWhether 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.
paginatebooleanWhether to use pagination controls.
variant"auto" | "list"The layout variant of the table component. - list: Always displays as a list layout. - auto: Automatically displays as a table on wide screens and as a list on narrow screens.

Events ​

EventType
nextpageEvent
previouspageEvent

Listen for these with @nextpage-style listeners on <STable>.

Slots ​

SlotDescription
defaultThe table structure displayed within the table component, including table headers, rows, and cells that organize data in a grid format.
filtersAdditional filters to display in the table, such as search fields or other input components that allow users to narrow down the displayed data.

Released under the MIT License.