Skip to main content
Kaleidoscope

IconButton

Icon buttons are for common actions that need to be displayed in a compact view or in context of a number of other actions.

Default

IconButtons are composed of the component with some slight differences in defaults and a few additional props. IconButton accepts all the same props as Button, with the addition of a specific icon and tooltip props. Unlike Button, IconButton's default type is ButtonType.Tertiary as this is the most common type for IconButtons.

⚛️ For a full description available props and variants inherited from the Button component, check out the .

Editable example

Best practices

  1. Avoid mixing and matching IconButton types that are adjacent to each other. Stick to the same type for a set of related actions.
  2. A tooltip isn't necessary for universally understood icons such as x to close, but in these cases an .

Types

Use the default ButtonType.Tertiary in most cases. For specific more important actions, ButtonType.Secondary can be used (often combined with isRound for standalone actions).

Editable example

Tooltip

IconButton includes an optional tooltip that's baked right in, no need to wrap it in a <Tooltip />. To use a tooltip, pass any tooltip props such as content, position etc to the tooltip prop. The tooltip prop accepts any prop that the supports.

Editable example

Sizes

Just like Button, IconButton accepts the ButtonSize enum to control its size. By default, IconButton uses the medium size.

Editable example

Rounded

Use the isRound prop for standalone buttons that aren't part of a set. This is most commonly used for add/create buttons which aren't commonly rendered as part of a group of buttons.

Editable example

Animation

IconButton can animate between two icons. Just give each icon a unique key and conditionally render them in the icon prop

Editable example

Accessibility

  1. Always provide text to describe an icon button. Typically this is done with the tooltip prop, which accepts all of the props for a . If a tooltip is not needed or provided, use an aria-label to describe the action for screen readers.