Button
Triggers actions or events, such as submitting forms, opening dialogs, or navigating to other pages. Use Button to let users perform specific tasks or initiate interactions throughout the interface. Buttons can also function as links, guiding users to internal or external destinations.
Anchor to propertiesProperties
- Anchor to accessibilityLabelaccessibilityLabelstring
A 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.
- Anchor to commandcommand'--auto' | '--show' | '--hide' | '--toggle'Default: '--auto'
Sets the action the command should take when this clickable is activated.
See the documentation of particular components for the actions they support.
--auto: a default action for the target component.--show: shows the target component.--hide: hides the target component.--toggle: toggles the target component.
- Anchor to commandForcommandForstring
Sets the element the commandFor should act on when this clickable is activated.
- Anchor to disableddisabledbooleanDefault: false
Disables the Button meaning it cannot be clicked or receive focus.
- Anchor to downloaddownloadstring
Causes the browser to treat the linked URL as a download with the string being the file name. Download only works for same-origin URLs or the
blob:anddata:schemes.- Anchor to hrefhrefstring
The URL to link to.
- If set, it will navigate to the location specified by
hrefafter executing theclickevent. - If a
is set, thecommandwill be executed instead of the navigation.
- If set, it will navigate to the location specified by
- Anchor to iconicon"" | "replace" | "search" | "split" | "link" | "edit" | "product" | "variant" | "collection" | "select" | "info" | "incomplete" | "complete" | "color" | "money" | "adjust" | "affiliate" | "airplane" | "alert-bubble" | "alert-circle" | "alert-diamond" | "alert-location" | "alert-octagon" | "alert-octagon-filled" | "alert-triangle"
The type of icon to be displayed in the Button.
- Anchor to interestForinterestForstring
Sets the element the interestFor should act on when this clickable is activated.
- Anchor to loadingloadingbooleanDefault: false
Replaces content with a loading indicator while a background action is being performed.
This also disables the Button.
- Anchor to targettarget"auto" | AnyString | "_blank" | "_self" | "_parent" | "_top"Default: 'auto'
Specifies where to display the linked URL.
- Anchor to tonetone"critical" | "auto" | "neutral"Default: 'auto'
Sets the tone of the Button based on the intention of the information being conveyed.
- Anchor to typetype"button" | "reset" | "submit"Default: 'button'
The behavior of the Button.
submit: Used to indicate the component acts as a submit button, meaning it submits the closest form.button: Used to indicate the component acts as a button, meaning it has no default action.reset: Used to indicate the component acts as a reset button, meaning it resets the closest form (returning fields to their default values).
This property is ignored if the component supports
hrefor/commandand one of them is set.- Anchor to variantvariant"auto" | "primary" | "secondary" | "tertiary"Default: 'auto' - the variant is automatically determined by the Button's context
Changes the visual appearance of the Button.
AnyString
Prevents widening string literal types in a union to `string`.
string & {}Anchor to eventsEvents
Learn more about registering events.
- Anchor to blurblurCallbackEventListener<typeof tagName> | null
- Anchor to clickclickCallbackEventListener<typeof tagName> | null
- Anchor to focusfocusCallbackEventListener<typeof tagName> | null
CallbackEventListener
(EventListener & {
(event: CallbackEvent<T>): void;
}) | nullCallbackEvent
Event & {
currentTarget: HTMLElementTagNameMap[T];
}Anchor to slotsSlots
- Anchor to childrenchildrenHTMLElement
The content of the Button.
Code
Examples
Code
jsx
<> <s-button variant="primary">Add Product</s-button> <s-button variant="secondary">Save Theme</s-button> </>html
<s-button variant="primary">Add Product</s-button> <s-button variant="secondary">Save Theme</s-button>
Anchor to examplesExamples
Component examples
Anchor to example-basic-usageBasic usage
Anchor to example-basic-usageBasic usage
Demonstrates a simple button with default styling, automatically determining its visual variant and using a clear, action-oriented label.
Anchor to example-variantsVariants
Showcases different button variants with varying visual emphasis, helping merchants understand action priorities through distinct styling.
Illustrates button tones that signal the semantic importance and potential impact of different actions through color and styling.
Anchor to example-with-iconWith icon
Showcases a button that combines a descriptive text label with an intuitive icon, enhancing visual communication of the action.
Anchor to example-loading-stateLoading state
Illustrates buttons in various loading states, providing visual feedback during asynchronous operations.
Anchor to example-form-statesForm states
Demonstrates buttons in different interaction states, showing how to represent disabled controls and submit actions within forms.
Anchor to example-delete-confirmationDelete confirmation
Illustrates a button pair for destructive actions, using a critical tone to emphasize the potentially irreversible nature of the operation.
Demonstrates a button group for executing operations on multiple selected items.
Anchor to example-component-interactionsComponent interactions
Demonstrates advanced button capabilities using command, , and properties to enable dynamic component communication.
Basic usage
Examples
Basic usage
Description
Demonstrates a simple button with default styling, automatically determining its visual variant and using a clear, action-oriented label.
jsx
<s-button>Save</s-button>html
<s-button>Save</s-button>Variants
Description
Showcases different button variants with varying visual emphasis, helping merchants understand action priorities through distinct styling.
jsx
<s-stack direction="inline" gap="base"> <s-button variant="primary">Primary</s-button> <s-button variant="secondary">Secondary</s-button> <s-button variant="tertiary">Tertiary</s-button> <s-button variant="auto">Auto</s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button variant="primary">Primary</s-button> <s-button variant="secondary">Secondary</s-button> <s-button variant="tertiary">Tertiary</s-button> <s-button variant="auto">Auto</s-button> </s-stack>Tones
Description
Illustrates button tones that signal the semantic importance and potential impact of different actions through color and styling.
jsx
<s-stack direction="inline" gap="base"> <s-button tone="critical">Delete</s-button> <s-button tone="neutral">Save draft</s-button> <s-button>Continue</s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button tone="critical">Delete</s-button> <s-button tone="neutral">Save draft</s-button> <s-button>Continue</s-button> </s-stack>With icon
Description
Showcases a button that combines a descriptive text label with an intuitive icon, enhancing visual communication of the action.
jsx
<s-button icon="plus">Add product</s-button>html
<s-button icon="plus">Add product</s-button>Icon-only button
Description
Demonstrates an icon-only button with an accessibility label, providing a compact interface that remains screen reader friendly.
jsx
<s-button icon="plus" accessibilityLabel="Add product" />html
<s-button icon="plus" accessibilityLabel="Add product"></s-button>Loading state
Description
Illustrates buttons in various loading states, providing visual feedback during asynchronous operations.
jsx
<s-stack direction="inline" gap="base"> <s-button loading variant="primary"> Saving product... </s-button> <s-button loading variant="secondary"> Updating 247 variants... </s-button> <s-button loading tone="neutral"> Processing shipment... </s-button> </s-stack>html
<!-- Product save operation --> <s-button loading variant="primary">Saving product...</s-button> <!-- Bulk inventory update --> <s-button loading variant="secondary">Updating 247 variants...</s-button> <!-- Order fulfillment --> <s-button loading tone="neutral">Processing shipment...</s-button>Form states
Description
Demonstrates buttons in different interaction states, showing how to represent disabled controls and submit actions within forms.
jsx
<s-stack direction="inline" gap="base"> <s-button disabled>Save draft</s-button> <s-button type="submit" variant="primary"> Save product </s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button disabled>Save draft</s-button> <s-button type="submit" variant="primary">Save product</s-button> </s-stack>Link buttons
Description
Showcases buttons that act as hyperlinks, supporting navigation to different pages, external resources, and file downloads.
jsx
<s-stack direction="inline" gap="base"> <s-button href="javascript:void(0)">View products</s-button> <s-button href="javascript:void(0)" target="_blank"> Help docs </s-button> <s-button href="javascript:void(0)" download="sales-report.csv"> Export data </s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button href="javascript:void(0)">View products</s-button> <s-button href="javascript:void(0)" target="_blank">Help docs</s-button> <s-button href="javascript:void(0)" download="sales-report.csv"> Export data </s-button> </s-stack>Form submission buttons
Description
Demonstrates a button group with carefully aligned actions, showing how to create a clear visual hierarchy for form submission and cancellation.
jsx
<s-stack direction="inline" gap="base" justifyContent="end"> <s-button variant="secondary">Cancel</s-button> <s-button variant="primary" type="submit"> Save product </s-button> </s-stack>html
<s-stack direction="inline" gap="base" justifyContent="end"> <s-button variant="secondary">Cancel</s-button> <s-button variant="primary" type="submit">Save product</s-button> </s-stack>Delete confirmation
Description
Illustrates a button pair for destructive actions, using a critical tone to emphasize the potentially irreversible nature of the operation.
jsx
<s-stack direction="inline" gap="base"> <s-button variant="secondary">Cancel</s-button> <s-button variant="primary" tone="critical"> Delete variant </s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button variant="secondary">Cancel</s-button> <s-button variant="primary" tone="critical">Delete variant</s-button> </s-stack>Navigation button with icon
Description
Showcases a navigation button with an icon, enabling quick access to different sections of the interface.
jsx
<s-button href="javascript:void(0)" icon="order"> View orders </s-button>html
<!-- Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. --> <s-button href="javascript:void(0)" icon="order">View orders</s-button>Button group for bulk operations
Description
Demonstrates a button group for executing operations on multiple selected items.
jsx
<s-stack direction="inline" gap="base"> <s-button variant="secondary">Export selected</s-button> <s-button variant="primary" tone="critical"> Delete selected </s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button variant="secondary">Export selected</s-button> <s-button variant="primary" tone="critical">Delete selected</s-button> </s-stack>Icon-only buttons with labels
Description
Showcases a set of compact, icon-only buttons with accessibility labels, perfect for creating dense interfaces.
jsx
<s-stack direction="inline" gap="base"> <s-button icon="duplicate" variant="tertiary" accessibilityLabel="Duplicate product" /> <s-button icon="view" variant="tertiary" accessibilityLabel="Preview product" /> <s-button icon="menu-horizontal" variant="tertiary" accessibilityLabel="More actions" /> </s-stack>html
<s-stack direction="inline" gap="base"> <s-button icon="duplicate" variant="tertiary" accessibilityLabel="Duplicate product" ></s-button> <s-button icon="view" variant="tertiary" accessibilityLabel="Preview product" ></s-button> <s-button icon="menu-horizontal" variant="tertiary" accessibilityLabel="More actions" ></s-button> </s-stack>Component interactions
Description
Demonstrates advanced button capabilities using `command`, `commandFor`, and `interestFor` properties to enable dynamic component communication.
jsx
<s-stack direction="inline" gap="base"> {/* Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. */} <s-button href="javascript:void(0)">Edit details</s-button> {/* Button that expresses interest in specific data */} <s-button interestFor="selected-products">Bulk edit</s-button> </s-stack>html
<s-stack direction="inline" gap="base"> <!-- Button that navigates using Shopify's navigation system. Use shopify:navigate for navigation. Refer to [handling navigation events](/docs/api/app-home?accordionItem=getting-started-existing-remix-application) for implementation details and framework-specific examples. --> <s-button href="javascript:void(0)">Edit details</s-button> <!-- Button that expresses interest in specific data --> <s-button interestFor="selected-products">Bulk edit</s-button> </s-stack>