Skip to content
Create account
or
Sign in
The Stripe Docs logo
/
Ask AI
Create account
Sign in
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Developer tools
Get started
Payments
Finance automation
Get started
Payments
Finance automation
Platforms and marketplaces
Money management
Overview
Versioning
Changelog
Upgrade your API version
Upgrade your SDK version
Developer tools
SDKs
API
Testing
Workbench
Event Destinations
Workflows
Stripe CLI
Stripe Shell
Developers Dashboard
Agent toolkit
Build with LLMsStripe for Visual Studio CodeStripe health alertsFile uploads
Security and privacy
Security
Extend Stripe
Stripe Apps
    Overview
    Get started
    Create an app
    How Stripe Apps work
    Sample apps
    Build an app
    Store secrets
    API authentication methods
    Authorization flows
    Server-side logic
    Listen to events
    Handle different modes
    Enable sandbox support
    App settings page
    Build a UI
    Onboarding
    Distribute your app
    Distribution options
    Upload your app
    Versions and releases
    Test your app
    Publish your app
    Promote your app
    Add deep links
    Create install links
    Assign roles in UI extensions
    Post-install actions
    App analytics
    Embedded components for Apps
    Embed third-party Stripe Apps
    Migrating to Stripe Apps
    Migrate or build an extension
    Migrate a plugin to Stripe Apps or Stripe Connect
    Reference
    App manifest
    CLI
    Extension SDK
    Permissions
    Viewports
    Design patterns
    Components
      Accordion
      Badge
      Banner
      BarChart
      Box
      Button
      ButtonGroup
      Checkbox
      Chip
      ContextView
      DateField
      Divider
      FocusView
      FormFieldGroup
      Icon
      Img
      Inline
      LineChart
      Link
      List
      Menu
      PropertyList
      Radio
      Select
      SettingsView
      SignInView
      Sparkline
      Spinner
      Switch
      Table
      Tabs
      Tasklist
      TextArea
      TextField
      Toast
      Tooltip
Stripe Connectors
Partners
Partner ecosystem
Partner certification
HomeDeveloper toolsStripe AppsComponents

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.

Copy page

To add the Button component to your app:

import {Button} from '@stripe/ui-extension-sdk/ui';

There are multiple button types available:

Loading example...
<Button type="primary">Primary</Button> <Button>Secondary</Button> <Button type="destructive">Destructive</Button>

Button props

PropertyType

children

Required

React.ReactNode

The contents of the component.

css

Optional

CSS | undefined

Related types: CSS.

disabled

Optional

boolean | undefined

Whether the action is disabled.

href

Optional

string | undefined

Native href attribute.

onPress

Optional

((event: PressEvent) => void) | undefined

Handler that is called when the press is released over the target.

size

Optional

("small" | "medium" | "large") | undefined

The size of the component.

target

Optional

("_self" | "_blank" | "_top" | "_parent") | undefined

Where to display the linked URL, as the name for a browsing context.

type

Optional

("primary" | "secondary" | "destructive") | undefined

The type of the Button.

className

OptionalDeprecated

string | undefined

CSS

PropertyType

alignX

Optional

("start" | "center" | "end" | "stretch") | undefined

Horizontal alignment. See Layout properties for details.

width

Optional

(number | "auto" | "fill" | "min" | "max" | "fit" | "1/2" | "1/3" | "2/3" | "1/4" | "2/4" | "3/4" | "1/5" | "2/5" | "3/5" | "4/5" | "1/6" | "2/6" | "3/6" | "4/6" | "5/6" | "1/12" | "2/12" | "3/12" | "4/12" | "5/12" | "6/12" | "7/12" | "8/12" | "9/12" | "10/12" | "11/12") | undefined

The width of the component. See Sizing for details.

Content guidelines

Use the {verb} + {noun} formula for labels

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

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

This applies for most cases except proper nouns and phrases.

Avoid punctuation

Avoid periods, exclamation points, and question marks.

Use second person

When referring to the user within a button or link, always use second person personal pronouns. Example: Post your status.

Primary buttons

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.

Loading example...
<Button type="primary" onPress={() => console.log('Button was pressed')}> Primary button </Button>

Secondary buttons

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.

Loading example...
<Button onPress={() => console.log('Button was pressed')}> Secondary button </Button>

Destructive buttons

Use destructive buttons exclusively for actions that result in the destruction of any object or data.

Loading example...
<Button type="destructive" onPress={() => console.log('Button was pressed')} > Destructive button </Button>

Button sizes

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.
Loading example...
<Button size="small">Small button</Button> <Button>Medium button</Button> <Button size="large">Large button</Button>

Disabled buttons

Loading example...
<Button type="primary" disabled> Hello! </Button> <Button disabled>Secondary</Button> <Button type="destructive" disabled> Destructive </Button>

Icons in buttons

Use an icon inside of a button:

Loading example...
<Button type="primary"> <Icon name="addCircle" /> Add customer </Button>

Full-width buttons

Create a full-width Button component using the css prop:

Loading example...
<Button type="primary" css={{width: 'fill', alignX: 'center'}}> Full-width button </Button>

Opening links in new tabs

Loading example...
<Button href="https://stripe.com" target="_blank"> Open link in new tab </Button>

See also

  • Design patterns to follow
  • Style your app
  • UI testing
Was this page helpful?
YesNo
Need help? Contact Support.
Join our early access program.
Check out our changelog.
Questions? Contact Sales.
LLM? Read llms.txt.
Powered by Markdoc