Skip to content
/ hiki Public

react dialog component that turn into drawer on small viewport

License

Notifications You must be signed in to change notification settings

monodyle/hiki

Repository files navigation


hiki - a dialog will turn into a drawer on small viewport

Preview

Preview the example on https://hiki.minhle.space/

Quick start

Uncontrolled

import { Dialog } from "@monodyle/hiki"; // not published yet...

function Application() {
  return (
    <Dialog target={({ open }) => <button onClick={open}>Open Dialog</button>}>
      {({ close }) => (
        <div className="content">
          {/* your code goes here */}
        </div>
      )}
    </Dialog>
  )
}

Controlled

import { Dialog } from "@monodyle/hiki"; // not published yet...

function Application() {
  const [open, setOpen] = useState(false)

  return (
    <Dialog open={open} onOpenChange={setOpen} target={<button onClick={() => setOpen(true)}>Open Dialog</button>}>
      <div className="content">
        {/* your code goes here */}
      </div>
    </Dialog>
  )
}

Development

yarn # install dependencies
yarn dev # make it awesome

Author

References

Inspired by Devon Govett

License

MIT © Monody Le 2023+

About

react dialog component that turn into drawer on small viewport

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published