Icon button

Icon button is used for buttons that show an icon in place of a text label.

Work in progressWe are currently transferring the React documentation for IconButton from a different site to this page. To view the original documentation with code examples, please visit the Primer React documentation for IconButton.
  • @primer/react@35.25.1
  • Alpha
  • Not reviewed for accessibility

Import

import {IconButton} from '@primer/react'

Examples

View in Storybook

Props

IconButton

NameDefaultDescription
childrenRequired
React.ReactNode

This will be the Button description.

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

Changes the look and feel of the button which is different for each variant

size
'small' | 'medium' | 'large'

Changes the size of the icon button component

icon
Component

provide an octicon. It will be placed in the center of the button

sx
SystemStyleObject