tweakpane / use-tweaks

🎛️ Tweak React components with Tweakpane
https://codesandbox.io/s/use-tweaks-example-58e02
MIT License
768 stars 23 forks source link

Folders #4

Closed gsimone closed 4 years ago

gsimone commented 4 years ago

Folders can be made with a context provider

<Pane>
   <Input name="outer" />
  <Folder title={title}>
      <Input name="test" />
   </Folder>
</Pane>

Here both Pane and Folder are folderContext.Providers that pass an instance of tweakpane or a pane.addFolder({ title })


function Input() {
  const { parent } = useContext(foldersContext);

   useEffect(() => { parent.addInput(...) }

}