Open History to see the last commit
1import { useState } from "react";
2
3export function useComposerMenuState(hidden = false) {
4 const [open, setOpen] = useState(false);
5 // Base UI does not notify us when we close it by changing its open prop.
6 // Reset the stored state too, so revealing the trigger cannot reopen it.
7 if (hidden && open) {
8 setOpen(false);
9 }
10 return [open && !hidden, setOpen] as const;
11}