ActionIcon
Primary action icon button to trigger an operation. It's a simple button that contains no text, only an icon.
import { ActionIcon } from 'rizzui/action-icon';
Default
The default style of ActionIcon component.
import { ActionIcon } from 'rizzui/action-icon';
export default function App() {
return (
<ActionIcon>
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
);
}
Variants
You can change the style of the ActionIcon using variant property.
import { ActionIcon } from 'rizzui/action-icon';
import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline';
export default function App() {
return (
<>
<ActionIcon>
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon variant="outline">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon variant="flat">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon variant="text">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon variant="danger">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
</>
);
}
Sizes
You can change the size of the ActionIcon using size property.
import { ActionIcon } from 'rizzui/action-icon';
import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline';
export default function App() {
return (
<>
<ActionIcon size="sm">
<AdjustmentsHorizontalIcon className="w-4 h-4" />
</ActionIcon>
<ActionIcon>
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon size="lg">
<AdjustmentsHorizontalIcon className="w-6 h-6" />
</ActionIcon>
</>
);
}
Loading
You can set the loading state of the ActionIcon button using isLoading property.
import { ActionIcon } from 'rizzui/action-icon';
import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline';
export default function App() {
return (
<>
<ActionIcon isLoading={true} variant="solid">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon isLoading={true} variant="outline">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon isLoading={true} variant="flat">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
<ActionIcon isLoading={true} variant="danger">
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
</>
);
}
Disabled
The disabled style of the ActionIcon component.
import { ActionIcon } from 'rizzui/action-icon';
import { AdjustmentsHorizontalIcon } from '@heroicons/react/24/outline';
export default function App() {
return (
<ActionIcon disabled={true}>
<AdjustmentsHorizontalIcon className="size-5" />
</ActionIcon>
);
}
API Reference
ActionIcon Props
Here is the API documentation of the ActionIcon component. And the rest of the props are the same as the original html button. You can use props like id, title, onClick, onFocus, onBlur etc.
| Props | Type | Description | Default |
|---|---|---|---|
| as | button or span | Render as | "button" |
| children | React.ReactNode | Use any SVG icon | __ |
| type | ActionIconButtonTypes | Set the original HTML type of button | "button" |
| variant | ActionIconVariants | Set the ActionIcon variants | "solid" |
| size | ActionIconSizes | Set the size of the component. "sm" is equivalent to the dense ActionIcon styling. | "md" |
| color | ActionIconColors | Change ActionIcon color | "primary" |
| isLoading | boolean | Set the loading status of ActionIcon | __ |
| disabled | boolean | Disabled state of the ActionIcon | __ |
| className | string | Add custom classes for extra style | __ |
| ref | Ref<HTMLButtonElement> | forwardRef | __ |
| ... | ButtonHTMLAttributes or HTMLAttributes | native props like onClick, title, aria-label ... | __ |
Action Icon Button Types
type ActionIconButtonTypes = 'button' | 'submit' | 'reset';
ActionIcon Variants
type ActionIconVariants = 'solid' | 'flat' | 'outline' | 'text';
ActionIcon Sizes
type ActionIconSizes = 'sm' | 'md' | 'lg';
ActionIcon Colors
type ActionIconColors = 'primary' | 'secondary' | 'danger';