Icon Button
A button that shows only an icon, such as a menu or close button. It needs an accessible label.
Usage
import { IconButton } from '@leverui/components';
<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
| Prop | Default | Type | Description |
|---|---|---|---|
spinnerPlacement | start | 'start' | 'end' | Side the spinner appears on. |
colorPalette | gray | string | Color palette, built-in or your own. |
size | md | '2xs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl' | '2xl' | Button size. |
variant | solid | 'solid' | 'subtle' | 'surface' | 'outline' | 'ghost' | 'plain' | Button style. |
spinner | — | JSX.Element | Spinner shown while loading. |
as | button | Native HTML tag | HTML tag to render. |
asChild | — | Solid render function | Render your own element with the button's props. |
Also takes native button attributes, including class and style.