Icon Button

import {IconButton} from "@qualcomm-ui/react/button"

Examples

Variants

Buttons come in three variants: fill, outline, and ghost. Customize these with the variant property.

Fill
Outline
Ghost
<IconButton icon={ExternalLink} variant="fill" />
<IconButton icon={ExternalLink} variant="outline" />
<IconButton icon={ExternalLink} variant="ghost" />

Emphasis

Control the visual emphasis with different colors: neutral, primary, and danger. Customize these with the emphasis prop.

Neutral
Primary
Danger
<IconButton emphasis="neutral" icon={ExternalLink} variant="fill" />
<IconButton emphasis="primary" icon={ExternalLink} variant="fill" />
<IconButton emphasis="danger" icon={ExternalLink} variant="fill" />

Sizes and Icons

Customize size using the size property. QUI buttons come with built-in support for lucide-react icons.

<IconButton
  emphasis="primary"
  icon={ExternalLink}
  size="sm"
  variant="fill"
/>
<IconButton
  emphasis="primary"
  icon={ExternalLink}
  size="md"
  variant="fill"
/>
<IconButton
  emphasis="primary"
  icon={ExternalLink}
  size="lg"
  variant="fill"
/>

Compact Density

Use the density prop to reduce the padding and height of the button. The options are default and compact.

<IconButton
  density="compact"
  emphasis="primary"
  icon={ExternalLink}
  size="sm"
  variant="fill"
/>
<IconButton
  density="compact"
  emphasis="primary"
  icon={ExternalLink}
  size="md"
  variant="fill"
/>
<IconButton
  density="compact"
  emphasis="primary"
  icon={ExternalLink}
  size="lg"
  variant="fill"
/>

Variant Combinations

FillOutlineGhost
<IconButton emphasis="neutral" icon={Search} variant="fill" />
<IconButton emphasis="neutral" icon={Search} variant="outline" />
<IconButton emphasis="neutral" icon={Search} variant="ghost" />

<IconButton emphasis="primary" icon={Search} variant="fill" />
<IconButton emphasis="primary" icon={Search} variant="outline" />
<IconButton emphasis="primary" icon={Search} variant="ghost" />

<IconButton emphasis="danger" icon={Search} variant="fill" />
<IconButton emphasis="danger" icon={Search} variant="outline" />
<IconButton emphasis="danger" icon={Search} variant="ghost" />

<IconButton disabled icon={Search} variant="fill" />
<IconButton disabled icon={Search} variant="outline" />
<IconButton disabled icon={Search} variant="ghost" />

Contrast Colors

<div className="bg-persistent-black flex gap-6 p-4">
  <IconButton
    emphasis="white-persistent"
    icon={ExternalLink}
    variant="fill"
  />
  <IconButton
    emphasis="white-persistent"
    icon={ExternalLink}
    variant="outline"
  />
  <IconButton
    emphasis="white-persistent"
    icon={ExternalLink}
    variant="ghost"
  />
</div>

<div className="bg-persistent-white flex gap-6 p-4">
  <IconButton
    emphasis="black-persistent"
    icon={ExternalLink}
    variant="fill"
  />
  <IconButton
    emphasis="black-persistent"
    icon={ExternalLink}
    variant="outline"
  />
  <IconButton
    emphasis="black-persistent"
    icon={ExternalLink}
    variant="ghost"
  />
</div>

API

<IconButton>

A styled icon button. Renders a <button> element by default.
PropTypeDefault
lucide-react icon. Can be supplied as a ReactElement for additional customization.
| LucideIcon
| ReactNode
The density of the button. Governs padding and height.
| 'default'
| 'compact'
'default'
Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
boolean
false
The style variant of the button. Governs colors.
| 'neutral'
| 'primary'
| 'danger'
| 'white-persistent'
| 'black-persistent'
'neutral'
Allows you to replace the component's HTML element with a different tag or component. Learn more
| ReactElement
| ((
props: object,
) => ReactElement)
The size of the component and its icons.
| 'sm'
| 'md'
| 'lg'
'md'
The style variant of the button. Governs colors.
| 'fill'
| 'ghost'
| 'outline'
'fill'
Type
| LucideIcon
| ReactNode
Description
lucide-react icon. Can be supplied as a ReactElement for additional customization.
Type
| 'default'
| 'compact'
Description
The density of the button. Governs padding and height.
Type
boolean
Description
Controls whether the component is interactive. When true, pointer/focus events are blocked, and the component is visually dimmed.
Type
| 'neutral'
| 'primary'
| 'danger'
| 'white-persistent'
| 'black-persistent'
Description
The style variant of the button. Governs colors.
Type
| ReactElement
| ((
props: object,
) => ReactElement)
Description
Allows you to replace the component's HTML element with a different tag or component. Learn more
Type
| 'sm'
| 'md'
| 'lg'
Description
The size of the component and its icons.
Type
| 'fill'
| 'ghost'
| 'outline'
Description
The style variant of the button. Governs colors.