Theme style
In code: ThemeStyle
Applies a saved theme to the whole tool. Put it in <head> of the root layout, and switch the theme on at <html> with themeAttributes(theme). Works on the server; the values are checked, so a database value is safe to pass.
Preview
New
Use
The code of the preview above
import { useState } from 'react';
import { Badge, Button, Row, Stack, Switch, ThemeStyle } from '@/components/ui';
function ThemeStyleDemo() {
const [on, setOn] = useState(false);
return (
<Stack gap={4}>
{on ? <ThemeStyle theme={{ brand: '#2563eb', greys: 'cool', radius: 4, font: 'dm' }} /> : null}
<Switch checked={on} onCheckedChange={setOn}>Try the blue, square look</Switch>
<Row gap={2}>
<Button variant="primary">Book</Button>
<Button>Later</Button>
<Badge tone="primary">New</Badge>
</Row>
</Stack>
);
}Options
| Option | Type | What it does |
|---|---|---|
theme Needed | unknown | The saved theme settings (from ThemeEditor or the database); unknown values are ignored. |
Other parts: states, do and don’t
Parts of a bigger component (a CardBody of a Card, a DialogTitle of a Dialog) and pieces used inside others. Use them inside their component, as its page shows.