Icon Button

Icon button renders an icon within in a button.

SourceTheme Source@chakra-ui/button

Import#

import { IconButton } from '@chakra-ui/react'

Usage#

<IconButton aria-label='Search database'>
<SearchIcon />
</IconButton>

Changing the color#

Pass the colorPalette prop to change the color of the button.

<IconButton colorPalette='blue' aria-label='Search database'>
<SearchIcon />
</IconButton>

Changing the size#

Pass the size prop to change the size of the button.

<IconButton colorPalette='teal' aria-label='Call Segun' size='lg'>
<PhoneIcon />
</IconButton>

Changing the variant#

Like the Button component, pass the variant prop to change the style of the button.

<IconButton
variant='outline'
colorPalette='teal'
aria-label='Send email'
icon={<EmailIcon />}
/>

Using a custom icon#

You can also use icons from popular libraries like react-icons and just pass it into the button.

<IconButton variant='outline' aria-label='Call Sage' fontSize='20px'>
<MdPhone />
</IconButton>
Edit this page on GitHub

Proudly made inNigeria by Segun Adebayo

Deployed by â–² Vercel