Bedform UIGuides
Styling
Customize OreUI with CSS variables, TailwindCSS, PandaCSS, and more.
Components import their styles themselves. To use the public ore-* classes on plain elements, import the stylesheet once:
import "@bedform/ui/styles.css";Classes
Pass className to a component to override its default styles.
<Button className="danger-action" type="button">
Delete
</Button>.danger-action {
background: #ca3636;
color: white;
min-height: 3rem;
}
.danger-action:hover {
background: #d54242;
}CSS variables
Modify CSS variables to change default styles.
<Switch labelClassName="large-thumb">Music</Switch>.large-thumb {
--ore-switch-thumb-size: 1.25rem;
}TailwindCSS
Use standard utilities for properties such as sizing and spacing. To preserve a component's state styles, customize its public --ore-* variables with arbitrary property utilities.
<Button
className="min-h-12 [--ore-button-background-default:#dc2626] [--ore-button-background-hover:#ef4444] [--ore-button-background-pressed:#b91c1c] [--ore-button-foreground:white]"
type="button"
>
Delete
</Button>The Button background draws its face, highlight, border, and shadow together, so a bg-* utility would replace that drawing instead of only changing its color.
PandaCSS
PandaCSS can generate a class that sets the same public variables. Pass the returned class name as className.
import { Button } from "@bedform/ui/button";
import { css } from "../styled-system/css";
const dangerAction = css({
minHeight: "3rem",
"--ore-button-background-default": "#dc2626",
"--ore-button-background-hover": "#ef4444",
"--ore-button-background-pressed": "#b91c1c",
"--ore-button-foreground": "white",
});
<Button className={dangerAction} type="button">
Delete
</Button>;