Skip to content

SPage <s-page> ​

The top-level page layout, with a heading, page actions and content areas. SPage is the typed Vue 3 wrapper for Shopify's Polaris <s-page> web component.

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

Best practices ​

  • Give every page a title. Set heading to a title that describes the page the merchant is on.
  • Add breadcrumbs inside a flow. When the page is one step in a larger flow, put links back in the breadcrumb-actions slot.
  • Keep header actions page-wide. Only place actions in the header when they apply to the whole page, not to one part of it.
  • Limit the number of actions. Use at most one primary action and three secondary actions on a page.
  • Leave the bottom of the page free of actions. Don't place any actions at the end of the page.
vue
<SPage heading="Edit product">
  <template #breadcrumb-actions>
    <SLink href="/products">Products</SLink>
  </template>
  <template #primary-action>
    <SButton variant="primary">Save</SButton>
  </template>
  <template #secondary-actions>
    <SButton>Duplicate</SButton>
    <SButton>Archive</SButton>
  </template>
  <!-- … -->
</SPage>

See Shopify's best practices for <s-page> for the full guidance.

Example ​

No orders have been placed yet.Create order
vue
<script setup>
import { SPage, SSection, SParagraph, SButton } from 'polaris-vue-elements'
</script>

<template>
  <SPage heading="Orders">
    <template #primary-action>
      <SButton variant="primary">Create order</SButton>
    </template>

    <SSection heading="Recent activity">
      <SParagraph>No orders have been placed yet.</SParagraph>
    </SSection>
  </SPage>
</template>

Props ​

PropTypeDescription
headingstringThe main page heading
inlineSize"base" | "small" | "large"The inline size of the page - base corresponds to a set default inline size - large full width with whitespace

Slots ​

SlotDescription
defaultThe main page content displayed within the page component, which serves as the primary container for the page's information and interface elements.
asideThe content to display in the aside section of the page. This slot is only rendered when inlineSize is "base".
breadcrumb-actionsThe navigation back actions for the page. Only accepts link components.
primary-actionThe primary action for the page. Only accepts a single button component with a variant of primary.
secondary-actionsThe secondary actions for the page. Only accepts button group and button components with a variant of secondary or auto.
supplemental-startA slot for content that comes before the main content, such as an s-banner.

Released under the MIT License. Vue logo by Evan You, CC BY-NC-SA 4.0.