Theme editor
In code: ThemeEditor
The look as a theme, three plain choices (a brand colour, the greys, the page) and a few sliders. The page follows live. Inside a <form>, the theme is sent as JSON under name; pass the saved value to <ThemeStyle>.
Preview
Theme
Flat layers, soft lines, depth only on what floats
Brand colour#c2eb32
Greys
Page
Page width
Fonts
Light or dark
Design a look at supply.family/ui and paste its code here. This look is sui2-bc2eb32-gn-ps-r12-d100-s175-ml
Use
The code of the preview above
import { ThemeEditor } from '@/components/ui';
<ThemeEditor />Options
| Option | Type | What it does |
|---|---|---|
className | string | More classes on the outer element, for layout around it (margins, grid placement), not to restyle it. |
defaultValue | unknown | The saved theme (anything normalizeTheme accepts). |
name | string · default 'theme' | Name of the hidden form field that carries the theme as JSON. |
onChange | (theme: Theme) => void | Runs with the whole theme each time a choice or a slider changes it. |
Without React
With the CSS in parts (/ui/css/), it needs these, besides the ones every page loads:
components/button.csscomponents/fields.csscomponents/range-slider.csscomponents/table.csscomponents/segmented-control.csscomponents/input-group.csscomponents/calendar.csscomponents/button-group-toggle.csscomponents/carousel-arrows.cssOther 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.