Skip to content

STableHeader <s-table-header>

ts
import { STableHeader } 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 variant="auto">
    <STableHeaderRow>
      <!-- STableHeader labels a column. `format` styles cell content (e.g. currency),
           and `listSlot` designates its role when the table falls back to `list` layout. -->
      <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
format"base" | "numeric" | "currency"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.
listSlot"primary" | "secondary" | "inline" | "kicker" | "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.

Slots

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