Customizing Style
November 8, 2025 ยท View on GitHub
Leva supports full theme customization through the theme prop on the <Leva> component. You can customize colors, spacing, typography, and more.
Basic Theme Structure
A theme is an object with the following structure:
const theme = {
colors: {
elevation1: '#292d39',
elevation2: '#181C20',
elevation3: '#373C4B',
accent1: '#0066DC',
accent2: '#007BFF',
accent3: '#3C93FF',
highlight1: '#535760',
highlight2: '#8C92A4',
highlight3: '#FEFEFE',
vivid1: '#ffcc00',
},
radii: {
xs: '2px',
sm: '3px',
lg: '10px',
},
space: {
sm: '6px',
md: '10px',
rowGap: '7px',
colGap: '7px',
},
fontSizes: {
root: '11px',
},
sizes: {
rootWidth: '280px',
controlWidth: '160px',
scrubberWidth: '8px',
scrubberHeight: '16px',
rowHeight: '24px',
folderHeight: '20px',
checkboxSize: '16px',
joystickWidth: '100px',
joystickHeight: '100px',
colorPickerWidth: '160px',
colorPickerHeight: '100px',
monitorHeight: '60px',
titleBarHeight: '39px',
},
borderWidths: {
root: '0px',
input: '1px',
focus: '1px',
hover: '1px',
active: '1px',
folder: '1px',
},
fontWeights: {
label: 'normal',
folder: 'normal',
button: 'normal',
},
}
Using a Theme
Apply your theme to the <Leva> component:
import { Leva } from 'leva'
function MyApp() {
return <Leva theme={myTheme} />
}
Theme Properties
Colors
Control the color scheme of the panel:
elevation1: Main background colorelevation2: Secondary background (folders, inputs)elevation3: Tertiary background (hover states)accent1: Primary accent coloraccent2: Secondary accent coloraccent3: Tertiary accent colorhighlight1: Muted text colorhighlight2: Regular text colorhighlight3: Bright text colorvivid1: Vivid accent color
Radii
Border radius values:
xs: Extra small radiussm: Small radiuslg: Large radius
Space
Spacing values:
sm: Small spacingmd: Medium spacingrowGap: Vertical gap between rowscolGap: Horizontal gap between columns
Font Sizes
root: Base font size for the entire panel
Sizes
Control dimensions of various UI elements:
rootWidth: Width of the panelcontrolWidth: Width of input controlsscrubberWidth: Width of scrubber handlesscrubberHeight: Height of scrubber handlesrowHeight: Height of each control rowfolderHeight: Height of folder headerscheckboxSize: Size of checkbox inputsjoystickWidth: Width of joystick controlsjoystickHeight: Height of joystick controlscolorPickerWidth: Width of color pickercolorPickerHeight: Height of color pickermonitorHeight: Height of monitor displaystitleBarHeight: Height of title bar
Border Widths
Border thickness for different states:
root: Root container borderinput: Input field bordersfocus: Focus state borderhover: Hover state borderactive: Active state borderfolder: Folder border
Font Weights
Text weight for different elements:
label: Control labelsfolder: Folder namesbutton: Button text
Example: Dark Theme
const darkTheme = {
colors: {
elevation1: '#1a1a1a',
elevation2: '#252525',
elevation3: '#333333',
accent1: '#0066DC',
accent2: '#007BFF',
accent3: '#3C93FF',
highlight1: '#666666',
highlight2: '#999999',
highlight3: '#ffffff',
vivid1: '#ffcc00',
},
radii: {
xs: '2px',
sm: '4px',
lg: '8px',
},
space: {
sm: '6px',
md: '10px',
rowGap: '7px',
colGap: '7px',
},
fontSizes: {
root: '12px',
},
}
function App() {
return <Leva theme={darkTheme} />
}
Example: Light Theme
const lightTheme = {
colors: {
elevation1: '#ffffff',
elevation2: '#f5f5f5',
elevation3: '#eeeeee',
accent1: '#0066DC',
accent2: '#007BFF',
accent3: '#3C93FF',
highlight1: '#666666',
highlight2: '#333333',
highlight3: '#000000',
vivid1: '#ffcc00',
},
// ... other properties
}
Dynamic Theme Editing
You can even create controls to edit your theme in real-time:
import { useControls, useCreateStore, Leva, LevaPanel, folder } from 'leva'
function ThemeEditor() {
const colorsStore = useCreateStore()
const sizesStore = useCreateStore()
const colors = useControls(
{
colors: folder({
elevation1: '#292d39',
elevation2: '#181C20',
accent1: '#0066DC',
// ... more colors
}),
},
{ store: colorsStore }
)
const sizes = useControls(
{
sizes: folder({
rootWidth: '280px',
controlWidth: '160px',
// ... more sizes
}),
},
{ store: sizesStore }
)
const theme = { colors, sizes }
return (
<>
<LevaPanel store={colorsStore} titleBar={{ title: 'Colors' }} />
<LevaPanel store={sizesStore} titleBar={{ title: 'Sizes' }} />
<Leva theme={theme} />
</>
)
}