ActionIcon
Usage
Children
ActionIcon accepts any React node as child. It does not control icon size, specify it manually on icon component to match ActionIcon size. For example, in tabler icons you can use size prop:
Variants
ActionIcon has 6 variants: transparent, hover, default, outline, filled and light:
Color
ActionIcon supports all colors from theme.colors:
Size and radius
Control button width and height with size
and border-radius with radius
.
Both props have predefined values: xs, sm, md, lg, xl.
Alternatively, use a number to set radius or size in px:
Close button
CloseButton is a premade ActionIcon with close icon, it is used in all other components: Popover, Modal, Notification, etc.
Component accepts the same props as ActionIcon with additional iconSize
prop to control icon width and height:
Usage with react-router and other libraries
To use ActionIcon component with react-router-dom
or other similar libraries pass Link
as component to ActionIcon:
To use custom component with TypeScript, provide type (should match component
prop):
Get element ref
To use ref
with custom component in TypeScript, specify generic type:
Accessibility
ActionIcon renders a regular button element. Set title
or aria-label
props for screen reader support: