Skip to content

SPressButton <s-press-button>

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

Example

SecondaryTertiaryDisabled
vue
<script setup>
import { ref } from 'vue'
import { SPressButton } from 'polaris-vue-elements'

const pressed = ref(false)
</script>

<template>
  <!-- SPressButton is a toggle-style button (aria-pressed) — pressed/defaultPressed
       control the on/off state instead of a click counter. -->
  <SPressButton icon="star" accessibilityLabel="Favorite" :pressed="pressed" @click="pressed = !pressed" />
  <SPressButton variant="secondary">Secondary</SPressButton>
  <SPressButton variant="tertiary">Tertiary</SPressButton>
  <SPressButton disabled>Disabled</SPressButton>
</template>

Props

PropTypeDescription
accessibilityLabelstringA label that describes the purpose or contents of the Button. It will be read to users using assistive technologies such as screen readers. Use this when using only an icon or the Button text is not enough context for users using assistive technologies.
defaultPressedbooleanWhether the button is pressed by default.
disabledbooleanDisables the Button meaning it cannot be clicked or receive focus.
icon"color" | "info" | "adjust" | "affiliate" | "airplane" | "alert-bubble" | "alert-circle" | "alert-diamond" … (510 more)The type of icon to be displayed in the Button.
inlineSize"auto" | "fill" | "fit-content"The displayed inline width of the Button. - auto: the size of the button depends on the surface and context. - fill: the button will takes up 100% of the available inline size. - fit-content: the button will take up the minimum inline-size required to fit its content.
langstringIndicate the text language. Useful when the text is in a different language than the rest of the page. It will allow assistive technologies such as screen readers to invoke the correct pronunciation. Reference of values ("subtag" label)
loadingbooleanReplaces content with a loading indicator while a background action is being performed. This also disables the Button.
pressedbooleanWhether the button is pressed.
tone"neutral"Sets the tone of the Button based on the intention of the information being conveyed.
variant"secondary" | "tertiary"Changes the visual appearance of the Button.

Some type columns above are truncated for readability; the full union is available in the library's generated TypeScript types (src/lib/generated/types.ts).

Events

EventType
blurCustomEvent
clickCustomEvent
focusCustomEvent

Listen for these with @blur-style listeners on <SPressButton>.

Slots

SlotDescription
defaultThe content of the PressButton.