logo

Import

Import the Gooey class to create a new gooey
import { Gooey } from 'gooey'
 
const gooey = new Gooey()

Basics

Use add to create a new input
gooey.add('hello', 'world')

gooey.add('count', 1, { min: -1 })
The type of input generated by add is inferred from the second argument.
Use addMany to create multiple inputs at once
gooey.addMany({
  stuff: true,
  more_stuff: {
    like_colors: '#4aa7ff' as const,
    or_buttons: () => alert('thanks!')
  }
})
Do stuff onChange
gooey.add('title', 'change me', {
  onChange: (v) => gooey.title = v
})
More event options
Alternatively, bind to any object to keep its values in sync automatically (as opposed to using add with events)
const data = {
  size: 12,
  color: '#4aa7ff' as const
}

gooey.bind(data, 'size')
gooey.bind(data, 'color')
Bind to an entire object with bindMany
const data = {
  wght: 100,
  wdth: 75,
}

gooey.bindMany(data)
Passing options to bindMany
Create folders with addFolder
const outer = gooey.addFolder('outer')

const inner = outer.addFolder('inner')

inner.add('say sike', () => outer.close(), {
  text: 'sike',
})
Pro tip  ·  click folder headers to open / close them