Icon-only button. Wraps Button and renders a single Icon with an accessible label.
Use IconButton for any icon-only control (toolbar action, close/confirm, row action, …). It is the replacement for Button's deprecated isIconButton prop, so prefer it over <Button isIconButton>.
Button.ButtonGroup and ButtonList.Always pass label — it becomes the icon's aria-label, which is the only accessible name an icon-only button has. There is no @uxf/form twin.
import { IconButton } from "@uxf/ui/icon-button";
// action
<IconButton iconName="user" label="User" onClick={onClick} />
// styled + as a cancel action
<IconButton
color="negative"
iconName="xmark"
label="Cancel"
onClick={handleCancel}
size="sm"
variant="secondary"
/>;
Extends Omit<ButtonProps, "children" | "isIconButton">, so all Button props except children and isIconButton are accepted (variant, color, size, isFullWidth, isDisabled, isLoading, as, href, onClick, type, analyticsCallback, …). Forwards its ref to the underlying anchor.
| Prop | Type | Default | Description |
|---|---|---|---|
iconName |
IconName |
— | Required. Icon to render. |
label |
string |
— | Required. Accessible label, set as the icon's aria-label. |
iconSize |
number |
— | Icon size in px (passed to Icon's size). |
variant, color and size are inherited from Button and accept the same values (each defaults to "default"):
| Group | Values |
|---|---|
variant |
default, secondary, text |
size |
sm, default, lg, xl |
color |
default, positive, negative, warning, info, inverted |
size also sets the square dimensions of the button (the width tracks the control height per size). Behavioural states (isLoading, isDisabled) behave as on Button.
Import the component stylesheet once in your global CSS, together with the Button stylesheet it builds on:
@import url("@uxf/ui/css/button.css");
@import url("@uxf/ui/css/icon-button.css");
Also requires the global @uxf/ui token layer, set up once per app — see @uxf/ui setup.