Icon Button

A button that shows only an icon, such as a menu or close button. It needs an accessible label.

Usage

Code
import { IconButton } from '@leverui/components';
Code
<IconButton aria-label="Search database">
  <SearchIcon />
</IconButton>

Examples

Sizes

Use the size prop to change the size of the button.

xs

sm

md

lg

Variants

Use the variant prop to change its visual style

solid

subtle

surface

outline

ghost

Color

Use the colorPalette prop to change the color of the button

Rounded

Set the border-radius style to var(--leverui-radii-full) to make the button fully rounded

Guides

Accessibility

Name the button with aria-label. Mark the icon aria-hidden="true".

For a standard close button, use Close Button.

Props

PropDefaultTypeDescription
spinnerPlacementstart'start' | 'end'Side the spinner appears on.
colorPalettegraystringColor palette, built-in or your own.
sizemd'2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl'Button size.
variantsolid'solid' | 'subtle' | 'surface' | 'outline' | 'ghost' | 'plain'Button style.
spinner—JSX.ElementSpinner shown while loading.
asbuttonNative HTML tagHTML tag to render.
asChild—Solid render functionRender your own element with the button's props.

Also takes native button attributes, including class and style.