Bedform UIButtons
Icon Button
An icon-only button.
Icon Button
*
boolean
*
string
*
Usage
import { IconButton } from "@bedform/ui/icon-button";
export function CloseButton() {
return (
<IconButton type="button" aria-label="Close">
<ore-icon aria-hidden="true">
<svg viewBox="0 0 8 8">
<path
fill="currentColor"
fillRule="evenodd"
d="M.5.5h1v1h.966v1h-1v-1H.5zm7 1h-1v-1h1zm-2 1v-1h1v1zm-1 1h1v-1h-1zm0 1v-1h-1v-1h-1v1h1v1h-1v1h-1v1h-1v1h1v-1h1v-1h1v-1zm0 0h1v1h-1zm1.034 2H6.5v1h1v-1h-.966v-1h-1z"
/>
</svg>
</ore-icon>
</IconButton>
);
}ore-icon is a styling element; see Icons for how to declare it for TypeScript.
Disabled
// closeIcon is the <svg> element from the example above.
<IconButton type="button" aria-label="Close" disabled>
<ore-icon aria-hidden="true">{closeIcon}</ore-icon>
</IconButton>API
IconButton renders a native button and accepts every button attribute, event and form behavior. It forwards its ref to the button.
| Prop | Type | Default |
|---|---|---|
disabled | boolean | false |
type | "button" | "reset" | "submit" | "submit" |
CSS variables
| Variable | Purpose |
|---|---|
--ore-icon-button-unit | Base size unit |
--ore-icon-button-background | Face background color |
--ore-icon-button-highlight | Top highlight color |
--ore-icon-button-shadow-color | Bottom shadow color |
--ore-icon-button-corner | Corner accent color |
--ore-icon-button-border | Border color |
--ore-icon-button-foreground | Icon and text color |
--ore-icon-button-place-items | Internal grid item alignment |
--ore-icon-button-width | Button width |
--ore-icon-button-height | Button height |
--ore-icon-button-padding | Internal padding |
--ore-icon-button-box-shadow | Additional outer box shadow |
Accessibility
Add an aria-label to describe the action. The icon inside the button should use aria-hidden="true".