Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Position the Leva UI within a DIV #488

Open
rmr-code opened this issue Jan 31, 2024 · 1 comment
Open

Position the Leva UI within a DIV #488

rmr-code opened this issue Jan 31, 2024 · 1 comment

Comments

@rmr-code
Copy link

I am using this beautifully designed UI component in a react three js environment. The scene has multiple geometries with some attributes all controlled by Leva. I find by default the Leva UI component is on the top right of the whole page. I would like it to be within the canvas parent div. How do I achieve it?

Thanks.

@rudolphmax
Copy link

Sure! Use the Leva component.

import { Leva } from 'leva'

const ControlsComponent = ( { props } : ControlsComponentProps) => {
  const { width } = useControls('Width', {
    width: { value: 20, min: 1, max: 90 }
  })

  return (
    <Leva
      fill
      titleBar={ drag: false }}
    />
  )
}

Here, I am also setting it to fill its parent and disabling dragging (I use it as part of a sidebar).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants