Button
Usage
Button triggers a clear user action such as saving, creating, confirming, or moving to the next step. Use the variant to communicate action hierarchy and intent, and the size to fit the surrounding layout without changing what the action means.
import { MtButton } from "@shopware-ag/meteor-component-library";
Examples
Variants
Each variant signals a different level of emphasis and intent.
Sizes
Match the button size to the surrounding layout without changing the meaning of the action.
With icon
Add an icon in the front or back slot to reinforce the action.
Icon only
Use square and an aria-label for a compact, icon-only control.
States
API reference
Props
| Prop | Type | Default |
|---|---|---|
is | string | Component | "button" |
disabled | boolean | |
variant | "critical" | "action" | "primary" | "secondary" | "tertiary" | "secondary" |
ghost | boolean | |
size | "default" | "small" | "x-small" | "large" | "small" |
square | boolean | |
block | boolean | |
link | string | undefined |
is-loading | boolean |
Slots
| Slot | Bindings |
|---|---|
default | any |
iconFront | any |
iconBack | any |
Best practices
Do
- Keep button labels short, specific, and action-oriented.
- Use
primaryfor the main action in a local context. - Use
secondaryortertiaryfor supporting actions. - Use
criticalonly for destructive or high-risk actions. - Use
squarewhen you render an icon-only button so the control stays visually balanced.
Don't
- Do not use multiple primary buttons in the same local action group.
- Do not use vague labels such as
SubmitorContinuewhen a clearer verb would help. - Do not rely on color alone to explain what a button will do.
- Do not use Button for purely navigational inline text links.
Behavior
- Button supports visual hierarchy through variants, but the label still carries the main meaning of the action.
- Loading and disabled states should be used to prevent duplicate actions or indicate temporary unavailability.
- The icon slots are optional enhancements. For icon-only buttons, use
squareand provide an accessible name.
Accessibility
- Button text should clearly describe the action without depending on surrounding context alone.
- If you use only an icon visually, ensure the button still has an accessible name.
- Icon-only buttons are valid, but they should use the
squareprop and a clear accessible label such asaria-label. - Disabled and loading buttons should be used intentionally so people understand why the action is unavailable.
Related components
- Link: when the user is moving to another page, route, or destination.