Button

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

  • @primer/react@36.1.0
  • 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.

countRequired
number | string

For counter buttons, the number to display.

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>