Button component for Stripe Apps
Buttons allow users to take actions, and you can use them to direct a user's attention or warn them of outcomes.
To add the Button
component to your app:
import {Button} from '@stripe/ui-extension-sdk/ui';
There are multiple button types available:
<Button type="primary">Primary</Button> <Button>Secondary</Button> <Button type="destructive">Destructive</Button>
Button props![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Property | Type |
---|---|
| Required
The contents of the component. |
| Optional
Related types: CSS. |
| Optional
Whether the action is disabled. |
| Optional
Native |
| Optional
Handler that is called when the press is released over the target. |
| Optional
The size of the component. |
| Optional
Where to display the linked URL, as the name for a browsing context. |
| Optional
The type of the |
| OptionalDeprecated
|
CSS![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Property | Type |
---|---|
| Optional
Horizontal alignment. See Layout properties for details. |
| Optional
The width of the component. See Sizing for details. |
Content guidelines![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Use the {verb} + {noun} formula for labels![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
For example, Update customer. It’s acceptable to break this pattern in the case of common actions like Done, Close, Cancel, Add, or Delete.
Be as descriptive as possible![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
When a button performs an action or navigates the user to a location, try to name that action or location within the label.
Use sentence case![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
This applies for most cases except proper nouns and phrases.
Avoid punctuation![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Avoid periods, exclamation points, and question marks.
Use second person![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
When referring to the user within a button or link, always use second person personal pronouns. Example: Post your status.
Primary buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Primary buttons initiate the primary action of any given page or flow. Avoid having more than one primary button available to the user at a given time.
<Button type="primary" onPress={() => console.log('Button was pressed')}> Primary button </Button>
Secondary buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Secondary buttons are the default and most common buttons in product interfaces. In general, use the secondary style for buttons that aren’t for primary actions.
<Button onPress={() => console.log('Button was pressed')}> Secondary button </Button>
Destructive buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Use destructive buttons exclusively for actions that result in the destruction of any object or data.
<Button type="destructive" onPress={() => console.log('Button was pressed')} > Destructive button </Button>
Button sizes![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Buttons are available in three sizes, which determine the height of the element. Buttons can be as wide as needed to fill their container.
- You can use small buttons in contexts where space is limited or to match the size of other, small text such as legal terms, and so on.
- Medium is the default size for buttons.
- You can use large buttons in contexts where a call to action (CTA) needs increased prominence.
<Button size="small">Small button</Button> <Button>Medium button</Button> <Button size="large">Large button</Button>
Disabled buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
<Button type="primary" disabled> Hello! </Button> <Button disabled>Secondary</Button> <Button type="destructive" disabled> Destructive </Button>
Icons in buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Use an icon inside of a button:
<Button type="primary"> <Icon name="addCircle" /> Add customer </Button>
Full-width buttons![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
Create a full-width Button
component using the css
prop:
<Button type="primary" css={{width: 'fill', alignX: 'center'}}> Full-width button </Button>
Opening links in new tabs![](https://b.stripecdn.com/docs-statics-srv/assets/fcc3a1c24df6fcffface6110ca4963de.svg)
<Button href="https://stripe.com" target="_blank"> Open link in new tab </Button>