Button
Buttons let users perform actions instantly, such as submitting forms, navigating pages, or triggering app functions. Built with comprehensive state management and semantic color coding, they communicate purpose and priority while maintaining consistent behavior across desktop and mobile environments.
import {Button} from "@qualcomm-ui/react/button"Examples
Variants
Buttons come in three variants: fill, outline, and ghost. Customize these with the variant property.
<Button emphasis="primary" startIcon={ExternalLink} variant="fill">
Action
</Button>
<Button emphasis="primary" startIcon={ExternalLink} variant="outline">
Action
</Button>
<Button emphasis="primary" startIcon={ExternalLink} variant="ghost">
Action
</Button>
Emphasis
Control the visual emphasis with different colors: neutral, primary, and danger.
<Button emphasis="neutral" startIcon={ExternalLink} variant="fill">
Action
</Button>
<Button emphasis="primary" startIcon={ExternalLink} variant="fill">
Action
</Button>
<Button emphasis="danger" startIcon={ExternalLink} variant="fill">
Action
</Button>
Sizes and Icons
Control dimensions with the size prop. Icons are supplied using the startIcon and endIcon props.
<Button
emphasis="primary"
size="sm"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
<Button
emphasis="primary"
size="md"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
<Button
emphasis="primary"
size="lg"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
Compact Density
Use the density prop to reduce the padding and height of the button. The options are default and compact.
<Button
density="compact"
emphasis="primary"
size="sm"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
<Button
density="compact"
emphasis="primary"
size="md"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
<Button
density="compact"
emphasis="primary"
size="lg"
startIcon={ExternalLink}
variant="fill"
>
Action
</Button>
Variant Combinations
This grid shows all button combinations across variants and emphasis levels. The bottom row demonstrates the disabled state, which grays out the button regardless of variant or emphasis.
<Button emphasis="neutral" variant="fill">
Action
</Button>
<Button emphasis="neutral" variant="outline">
Action
</Button>
<Button emphasis="neutral" variant="ghost">
Action
</Button>
<Button emphasis="primary" variant="fill">
Action
</Button>
<Button emphasis="primary" variant="outline">
Action
</Button>
<Button emphasis="primary" variant="ghost">
Action
</Button>
<Button emphasis="danger" variant="fill">
Action
</Button>
<Button emphasis="danger" variant="outline">
Action
</Button>
<Button emphasis="danger" variant="ghost">
Action
</Button>
<Button disabled variant="fill">
Action
</Button>
<Button disabled variant="outline">
Action
</Button>
<Button disabled variant="ghost">
Action
</Button>
Contrast Colors
Use persistent-white for buttons on dark backgrounds and persistent-black for buttons on light backgrounds. These emphasis values maintain consistent contrast regardless of the active theme.
<div className="bg-persistent-black flex gap-8 rounded-md p-3">
<Button emphasis="persistent-white" variant="fill">
Action
</Button>
<Button emphasis="persistent-white" variant="outline">
Action
</Button>
<Button emphasis="persistent-white" variant="ghost">
Action
</Button>
</div>
<div className="bg-persistent-white flex gap-8 rounded-md p-3">
<Button emphasis="persistent-black" variant="fill">
Action
</Button>
<Button emphasis="persistent-black" variant="outline">
Action
</Button>
<Button emphasis="persistent-black" variant="ghost">
Action
</Button>
</div>
Inverse Contrast
To flip contrast against the active theme, set emphasis to inverse.
<Button emphasis="inverse" variant="fill">
Action
</Button>
<Button emphasis="inverse" variant="outline">
Action
</Button>
<Button emphasis="inverse" variant="ghost">
Action
</Button>
Badge
Supply a NumberBadge or StatusBadge with the badge prop. The badge renders after the label and before the end icon.
The button passes these defaults to its badge:
- A disabled button disables its badge.
- Badge size follows the button size.
NumberBadgeemphasis follows the button'svariantandemphasis.StatusBadgeemphasis is not changed.
Props set on the badge take precedence over these defaults.
| Button size | NumberBadge size | StatusBadge size |
|---|---|---|
sm | xs | sm |
md | xs | sm |
lg | sm | md |
| Button emphasis | NumberBadge emphasis on fill | NumberBadge emphasis on outline and ghost |
|---|---|---|
neutral | persistent-white | neutral |
primary | persistent-white | brand |
danger | persistent-white | danger |
persistent-white | persistent-white | persistent-white |
persistent-black | persistent-black | persistent-black |
inverse | neutral | neutral |
The badge prop is also available on Menu.Button, and on Menu.SplitButton through actionProps.badge.
<Button
badge={<NumberBadge value={3} />}
emphasis="primary"
startIcon={Mail}
variant="fill"
>
Inbox
</Button>
<Button
badge={<NumberBadge value={120} />}
emphasis="primary"
variant="outline"
>
Notifications
</Button>
<Button badge={<StatusBadge emphasis="success" />} variant="outline">
Online
</Button>
Menu Button
For a button that opens a dropdown, use Menu.Button for a labeled trigger or Menu.IconButton for an icon-only trigger.
Split Button
For a button that pairs a primary action with a dropdown of related actions, use Menu.SplitButton.
API
<Button>
NumberBadge or StatusBadge, positioned after the text content. Its
emphasis, size, and disabled state default to values that match the button.
Props set on the badge take precedence.| 'default'
| 'compact'
booleantrue, pointer/focus
events are blocked, and the component is visually dimmed.| 'neutral'
| 'primary'
| 'danger'
| 'persistent-white'
| 'persistent-black'
| 'inverse'
| 'white-persistent'
| 'black-persistent'
| LucideIcon
| ReactElement
| null
LucideIcon, the size will automatically match the size prop.
Supply as a ReactElement for additional customization.| ReactElement
| ((
props: object,
) => ReactElement)
| 'sm'
| 'md'
| 'lg'
| LucideIcon
| ReactElement
| null
LucideIcon,
the size will automatically match the size prop. Supply as a
ReactElement for additional customization.| 'fill'
| 'ghost'
| 'outline'
className'qui-button__root'data-button-part'root'data-density| 'default'
| 'compact'
data-disabled'' | undefined
data-kind'text'data-size| 'sm'
| 'md'
| 'lg'
data-variant| 'fill'
| 'ghost'
| 'outline'
Start Icon
Provided via the startIcon prop.
className'qui-button__icon'data-button-part'icon'data-density| 'default'
| 'compact'
data-placement'start'data-size| 'sm'
| 'md'
| 'lg'
End Icon
Provided via the endIcon prop.
className'qui-button__icon'data-button-part'icon'data-density| 'default'
| 'compact'
data-placement'end'data-size| 'sm'
| 'md'
| 'lg'
<button>element by default.