IconButtonA button component designed specifically for icons with various sizes and states.
Import and usage.
The
The IconButton component has different states: default, hover, and disabled.
The IconButton component can be used with a letter.
The IconButton uses CSS variables for consistent styling across themes:
Install the component from your command line.
npm install @raystack/apsara
import { IconButton } from '@raystack/apsara/v1' <IconButton size={2}> <InfoCircledIcon /> </IconButton>
IconButton component accepts the following props:
size: Size of the button (1|2|3|4, default: 2)disabled: Whether the button is disabledclassName: Additional CSS class namesonClick: onClick function triggered when iconButton is clicked.- All other HTMLButtonElement attributes from React
size prop. The available size options are:
loading...
loading...
loading...
- Background color uses
--rs-color-background-base-primary - Border color uses
--rs-color-border-base-primary - Text color uses
--rs-color-text-base-primary - Hover state uses
--rs-color-background-base-primary-hover - Disabled state uses reduced opacity and different background/border colors
- Keyboard navigation support
- Proper disabled state handling
- Can be focused and activated using keyboard
- Supports all standard button ARIA attributes
- Provide meaningful aria-label when the button's purpose isn't clear from the icon alone
- Consider adding tooltips for icon-only buttons