Icon Button
Initiates an action, such as completing a task or submitting information. Renders only a single icon as children with an accessible, screen-reader-only label.
Size xs
Size sm
Size md
Disabled
import { IconButton } from "@ngrok/mantle/button";
import { Fire } from "@phosphor-icons/react";
} />
} />
} />
} />
} />
} />
isLoading
isLoading
determines whether or not the icon button is in a loading state, default false
. Setting isLoading
will replace the icon with a spinner. It will also disable user interaction with the button and set aria-disabled
.
idle
isLoading
import { IconButton } from "@ngrok/mantle/button";
import { Fire } from "@phosphor-icons/react";
} />
} />
} />
} />
Composition
When you want to render something else as a IconButton
, you can use the asChild
prop to compose. This is useful when you want to splat the IconButton
styling onto a Link
from remix
or react-router
. Keep in mind that when you use asChild
the type
prop will NOT be passed to the child component.
API Reference
The IconButton
accepts the following props in addition to the standard HTML button attributes.
Prop | Type | Default | Description |
---|---|---|---|
appearance |
| outlined | Defines the visual style of the |
asChild | boolean | false | Use the |
label | string | — | The accessible label for the icon. This label will be visually hidden but announced to screen reader users, similar to alt text for img tags. |
isLoading | boolean | false | Determines whether or not the icon button is in a loading state, default |
size |
| md | The size of the |
type |
| — | The default behavior of the
|