@fluixi-ui/theme
v0.1.0-alpha.6
Published
Headless theme + skin switching for the Fluixi UI ecosystem
Readme
@fluixi-ui/theme
Headless theme + skin switching for the Fluixi UI ecosystem. A thin, ergonomic layer
over @fluixi/core's createTheme that gives you providers, hooks, and headless
switcher components for each theming axis — so you stop hand-rolling createTheme
config, persistence, no-flash scripts, and picker UI.
Three orthogonal axes: color scheme (data-theme, light/dark), skin
(data-ui, the design language — fluixi/material/soft), and any custom axis
(data-accent, …) via createThemeAxis.
Install
pnpm add @fluixi-ui/themeSkin switching
You import the skin stylesheets you want to bundle; the provider owns the switching + persistence.
import '@fluixi-ui/skin-material/styles.css';
import '@fluixi-ui/skin-soft/styles.css';
import { SkinProvider, SkinSwitcher } from '@fluixi-ui/theme';
<SkinProvider skins={['fluixi', 'material', 'soft']} storageKey="skin">
<App />
<SkinSwitcher labels={{ fluixi: 'Fluixi', material: 'Material', soft: 'Soft' }} />
</SkinProvider>useSkin() returns the controller ({ value, set, toggle, options }) for custom UI.
Color scheme
import { ColorSchemeProvider, ColorSchemeToggle } from '@fluixi-ui/theme';
<ColorSchemeProvider system>
<App />
<ColorSchemeToggle>🌓</ColorSchemeToggle>
</ColorSchemeProvider>ColorSchemeSwitcher renders a segmented control; useColorScheme() exposes the
controller. system follows the OS preference when nothing is stored.
Custom axis
import { createThemeAxis } from '@fluixi-ui/theme';
const accent = createThemeAxis({
values: ['blue', 'violet', 'rose', 'green'],
attribute: 'data-accent',
storageKey: 'accent',
});
accent.init(); // apply persisted value on startup
accent.set('rose'); // switchStyling the switchers
The switchers are headless. Style via their data hooks:
[data-theme-switcher] [data-value] { … }
[data-theme-switcher] [data-value][data-active] { … }No-flash SSR
Each controller exposes headScript() — inline its string in your document <head>
to set the attribute before paint (no theme flash on first render).
Part of the Fluixi UI component library.
