Sajari UI

Icon Button

IconButton composes the Button component, except that it renders only an icon.

Since it's only an icon that's rendered, it's required to pass the label prop, so screen readers can give meaning to the button.

Import

Usage

Editable Example

Appearance

The IconButton component accepts most of the props from the Button component so we can use appearance prop to change the color of the button.

Editable Example

Sizes

Just like the Button component, pass the size and iconSize props to change the size of the button and icon.

Editable Example

Props

NameTypeDefaultDescription
icon (required)IconProps['name']The icon to be used. Refer to the Icons section of the docs for the available icon options.
iconSizeIconProps['size']Shorthand to set both iconBeforeSize and iconAfterSize.
roundedbooleanfalseIf true, the button will be perfectly round. Else, it'll be slightly round.
label (required)stringA11y: A label that describes the button.
appearancedefault, primary, secondary, success, warning, danger, ghost, link, subtle-link, nonedefaultThe variant of the button style to use.
disabledbooleanIf true, the button will be disabled.
loadingbooleanIf true, the button will show a spinner.
loadingTextstringThe label to show in the button when loading is true. If no text is passed, it only shows the spinner
sizexs, sm, md, lg , xlmdThe size of the button.