Customize Lever UI with CSS
Themes are plain CSS, so there are no types to generate. Import the default styles before your own stylesheet.
import '@leverui/components/styles.css';
import './theme.css';
Set --leverui-* variables on :root in theme.css to change the whole app.
:root {
--leverui-colors-blue-500: #6254c7;
--leverui-fonts-body: 'Inter', sans-serif;
--leverui-radii-md: 0.75rem;
}
Give a Theme a class to theme one section.
import { Button, Theme } from '@leverui/components';
<Theme appearance="light" class="marketing-panel">
<Button colorPalette="blue">Learn more</Button>
<Button colorPalette="blue" variant="subtle">
See details
</Button>
</Theme>;
.marketing-panel {
--leverui-colors-bg: #f5f0ff;
--leverui-colors-fg: #281c42;
--leverui-colors-blue-solid: #6254c7;
--leverui-colors-blue-contrast: #fff;
--leverui-colors-blue-subtle: #e9e1ff;
--leverui-colors-blue-fg: #43328c;
--leverui-radii-l2: 12px;
}
appearance="light"keeps the section light when the app goes dark. AThemewithoutappearanceinherits the surrounding mode.- The overrides are fixed colors. They do not adapt to the mode.
- To change a section's background, set a semantic variable such as
--leverui-colors-bg. Changing a scale color does not replace it. blue-solidandblue-subtlerestyle the Button variants.
Component CSS hooks
import { Box } from '@leverui/components';
<Box class="outlined-panel">Content</Box>;
.outlined-panel {
box-shadow: 0 0 0 1px var(--leverui-colors-red-500);
}
Set --leverui-tabs-indicator-bg, --leverui-tabs-indicator-shadow, and
--leverui-tabs-trigger-radius on the Tabs root to restyle its indicator.
--leverui-private-* variables are not public.
Check root and nested overrides in light and dark modes. For a new variant, add your own class with CSS for its states and breakpoints.