configuration.md
November 8, 2025 ยท View on GitHub
Configuration
You can configure Leva by using the <Leva> component anywhere in your App:
import { Leva } from 'leva'
export default function MyApp() {
return (
<>
<Leva
theme={myTheme} // you can pass a custom theme (see the styling section)
fill // default = false, true makes the pane fill the parent dom node it's rendered in
flat // default = false, true removes border radius and shadow
oneLineLabels // default = false, alternative layout for labels, with labels and fields on separate rows
hideTitleBar // default = false, hides the GUI header
collapsed // default = false, when true the GUI is collapsed
hidden // default = false, when true the GUI is hidden
neverHide // default = false, when true the GUI stays visible even when no controls are mounted
hideCopyButton // default = false, hides the copy button in the title bar
titleBar={{
// Configure title bar options
title: 'My Controls', // Custom title
drag: true, // Enable dragging
filter: true, // Enable filter/search
position: { x: 0, y: 0 }, // Initial position (when drag is enabled)
onDrag: (position) => {}, // Callback when dragged
}}
/>
</>
)
}
Panel Props
theme: Custom theme object (see Styling)fill: Makes the pane fill its parent containerflat: Removes border radius and shadowoneLineLabels: Alternative layout with labels and fields on separate rowshideTitleBar: Hides the entire title barcollapsed: Initial collapsed state (can be controlled)hidden: Hides the GUI completelyneverHide: Keeps GUI visible even when no controls are mountedhideCopyButton: Hides the copy button in the title bartitleBar: Object with title bar configuration:title: Custom title stringdrag: Enable/disable draggingfilter: Enable/disable filter/searchposition: Initial position{ x, y }(when drag is enabled)onDrag: Callback(position) => voidwhen panel is dragged
Using Multiple Panels
You can create multiple panels using LevaPanel with custom stores:
import { LevaPanel, useCreateStore, useControls } from 'leva'
function MyApp() {
const store1 = useCreateStore()
const store2 = useCreateStore()
const values1 = useControls({ x: 0 }, { store: store1 })
const values2 = useControls({ y: 0 }, { store: store2 })
return (
<>
<LevaPanel store={store1} titleBar={{ title: 'Panel 1' }} />
<LevaPanel store={store2} titleBar={{ title: 'Panel 2' }} />
</>
)
}
Disabling the GUI
Each instance of the useControls hook will render the panel. If you want to completely disable the GUI based on preferences, you need to explicitly set hidden to false.
import { Leva } from 'leva'
function MyComponent() {
const { myValue } = useControls({ myValue: 10 }) // Won't be visible because the panel will not render.
return myValue
}
export default function MyApp() {
return (
<>
<Leva hidden={true} />
</>
)
}
Controlled Collapsed State
You can control the collapsed state from outside:
function MyApp() {
const [collapsed, setCollapsed] = useState(true)
return (
<>
<button onClick={() => setCollapsed(!collapsed)}>{collapsed ? 'Expand' : 'Collapse'}</button>
<Leva
collapsed={{
collapsed,
onChange: (c) => setCollapsed(c),
}}
/>
</>
)
}