Button

Button is used to initiate actions on a page or form.

  • @primer/react@35.32.1
  • Alpha
  • Not reviewed for accessibility

Import

import {Button} from '@primer/react'

Examples

View in Storybook

Props

Button

NameDefaultDescription
childrenRequired
React.ReactNode

The content of the button.

variant
'default'| 'default' | 'primary' | 'danger' | 'outline' | 'invisible'

Change the visual style of the button.

size
'medium'| 'small' | 'medium' | 'large'
leadingIconDeprecated
React.ComponentType<OcticonProps>

An icon to display before the button text.

leadingVisual
React.ElementType

A visual to display before the button text.

trailingIconDeprecated
React.ComponentType<OcticonProps>

An icon to display after the button text.

trailingVisual
React.ElementType

A visual to display after the button text.

as
'button'React.ElementType
sx
SystemStyleObject
ref
React.RefObject<HTMLButtonElement>

Button.Counter

NameDefaultDescription
childrenRequired
number

The counter value.

sx
SystemStyleObject