IconButton

Icon buttons are commonly found in app bars and toolbars. Icons are also appropriate for toggle buttons that allow a single choice to be selected or deselected, such as adding or removing a star to an item.

<div style={{ display: 'flex' }}>
<IconButton
aria-label="menu button"
sx={{ marginRight: '8px' }}
onClick={() => console.log('clicked icon')}
>
<MenuHamburger />
</IconButton>
<IconButton disabled sx={{ marginRight: '8px' }}>
<MenuHamburger />
</IconButton>
<IconButton
color="black"
onClick={() => console.log('clicked icon')}
size="small"
sx={{ marginRight: '8px' }}
>
<MenuDots />
</IconButton>
<IconButton
color="black"
onClick={() => console.log('clicked icon')}
size="small"
sx={{ marginRight: '8px' }}
disabled
>
<MenuDots />
</IconButton>
<IconButton color="white" sx={{ marginRight: '8px' }}>
<Trophy />
</IconButton>
<IconButton color="white" disabled>
<Trophy />
</IconButton>
</div>

Props

PropTypeDefaultDescription
childrennodeThe icon element.
classesobjectOverride or extend the styles applied to the component. See CSS API below for more details.
color'default' | 'black' | 'white''default'The color of the component. It supports those theme colors that make sense for this component.
data-testidstringdata-testid added to the root element of the component
disabledboolfalseIf true, the button will be disabled.
disableFocusRippleboolfalseIf true, the keyboard focus ripple will be disabled.
disableRippleboolIf true, the ripple effect will be disabled.
edge'start' | 'end' | falsefalseIf given, uses a negative margin to counteract the padding on one side (this is often helpful for aligning the left or right side of the icon with content above or below, without ruining the border size and shape).
size'small' | 'medium''medium'The size of the button. small is equivalent to the dense button styling.
sxArray<func | object | bool> | func | objectThe system prop that allows defining system overrides as well as additional CSS styles.

Examples

see Button