Theming
Configure components with ConfigProvider. Start with a primary color, base radius and control height; related sizes and interaction colors are derived for you.
Start with a few settings
Wrap the application and import the stylesheet once:
Omitted settings use defaults. Hover, pressed, soft backgrounds and focus colors follow the primary color automatically.
Try your theme
Adjust color, radius, height and appearance. Copy the generated ConfigProvider code into your application.
A little green. Many possibilities.
Start small and build your own interface.
Your style, your choice
A few settings shape the look you want.
import { Button, ConfigProvider } from '@sudden3/leaf-ui';
<ConfigProvider theme={{
primaryColor: '#20834a',
borderRadius: 10,
controlHeight: 34,
appearance: 'light',
}}>
<Button>Save</Button>
</ConfigProvider>Derived sizes
The defaults are a 10px base radius, 34px control height and 14px font size:
Numbers are pixels; CSS lengths with units are also accepted. Buttons, inputs and pickers share the same sizes.
Regional themes
Nested providers override only supplied settings, including individual token overrides:
Floating panels, Modal and message / confirm context holders placed in a region inherit its theme. Set locale separately for built-in text.
Appearance and switching
Dark appearance supplies suitable text, surface, border and status colors. Explicit primary colors keep their value. Pair very light brand colors with a suitable onPrimaryColor override.
Advanced overrides
Use theme.tokens when you need specific derived sizes, semantic colors, surfaces, typography, motion or overlay stacking:
Explicit small and large sizes take precedence over derived values. See LeafThemeTokens for all options.
motion: false disables transitions and pauses loading icons. System reduced-motion preferences remain respected.
Reuse styles in your own components
Read the current region's CSS variables in your application styles. Use ConfigProvider to configure Leaf UI, and var() to make custom components follow that configuration:
Place custom components inside the intended provider. Import the compiled styles.css; consumers do not need Sass.
Server rendering
Static CSS and dynamic themes work together without generating CSS at runtime. See SSR usage for Next.js and other frameworks.