Bedform UI
CSS Variable Override
Customize OreUI with CSS variables.
OreUI exposes global design tokens and component-level variables. Set them in normal CSS. Import the default stylesheet first, so that your overrides come after it in the cascade.
Global theme
Override root tokens to update every component that uses them.
@import "@bedform/ui/styles.css";
:root {
--ore-color-primary-background: #2e6be5;
--ore-color-primary-background-hover: #8cb3ff;
--ore-color-primary-background-pressed: #1452cc;
--ore-color-primary-shadow: #1452cc;
}Scoped theme
Set tokens in a container to limit them to parts of the page.
<section className="realms-theme">
<Button type="button">Create Realm</Button>
<ProgressBar value={65} max={100} aria-label="Realm setup" />
</section>.realms-theme {
--ore-color-primary-background: var(--ore-color-realms-background);
--ore-color-primary-background-hover: var(
--ore-color-realms-background-hover
);
--ore-color-primary-background-pressed: var(
--ore-color-realms-background-pressed
);
--ore-color-primary-highlight: var(--ore-color-realms-highlight);
--ore-color-primary-shadow: var(--ore-color-realms-shadow);
}One component
Use component-level variables to change a specific component without replacing the global theme.
<Button className="realms-action" type="button">
Create Realm
</Button>.realms-action {
--ore-button-background-default: var(--ore-color-realms-background);
--ore-button-background-hover: var(--ore-color-realms-background-hover);
--ore-button-background-pressed: var(--ore-color-realms-background-pressed);
--ore-button-highlight-default: var(--ore-color-realms-highlight);
--ore-button-shadow: var(--ore-color-realms-shadow);
min-width: 12rem;
}Fallbacks
Wrap overrides in your own variables when you need a public theme API.
.game-menu {
--ore-button-background-default: var(
--menu-action-background,
var(--ore-color-primary-background)
);
}OreUI component selectors use low specificity, so classes and utilities can also override regular CSS properties without !important. Button colors are drawn from component variables, so override those variables with arbitrary property utilities:
<Button
className="[--ore-button-background-default:#2563eb] [--ore-button-background-hover:#3b82f6] [--ore-button-background-pressed:#1d4ed8]"
type="button"
>
Create a server
</Button>