Skip to content
Source
Sign inSign up
Open History to see the last commit

useComposerMenuState.ts

10 lines319 Bytes

1import { useState } from "react";
2​
3export function useComposerMenuState(hidden = false) {
4 const [open, setOpen] = useState(false);
5 // Closing via the open prop does not notify Base UI listeners; reset stored state too.
6 if (hidden && open) {
7 setOpen(false);
8 }
9 return [open && !hidden, setOpen] as const;