Skip to content

Icon Button

An icon button is the Button component rendered with only an icon and no text label. Set the iconOnly prop to optimize the button’s styling for a single icon.

Because an icon button has no visible label, you must provide tooltipProps so the action stays accessible. If you intentionally want to skip the tooltip, set ignoreIconOnlyTooltip.

Default Icon Button

Installation

import { Button, IconV2 } from '@harnessio/ui/components'
// Icon only button — provide tooltipProps for accessibility
<Button iconOnly tooltipProps={{ content: 'Add' }}>
<IconV2 name="plus" />
</Button>
// Skip the tooltip explicitly
<Button variant="secondary" size="sm" iconOnly ignoreIconOnlyTooltip>
<IconV2 name="git-branch" />
</Button>
// The 2xs and 3xs sizes set iconOnly automatically
<Button variant="outline" size="2xs" ignoreIconOnlyTooltip>
<IconV2 name="check" />
</Button>

Variants and Sizes

Icon buttons support the same variants and sizes as a regular Button. The 2xs and 3xs sizes enable iconOnly automatically.

AI Icon Button

The ai variant pairs with iconOnly for AI-related actions, including the automatic loading state from a promise onClick.