UNPKG

@wordpress/components

Version:
12 lines (11 loc) • 632 B
import { createContext, useContext } from "@wordpress/element"; // packages/components/src/toggle-group-control/context.ts const ToggleGroupControlContext = createContext(void 0); ToggleGroupControlContext.displayName = "ToggleGroupControlContext"; const useToggleGroupControlContext = (componentName = "ToggleGroupControlOptionBase") => { const context = useContext(ToggleGroupControlContext); if (!context) throw new Error(`${componentName} can only be rendered inside ToggleGroupControl.`); return context; }; export { ToggleGroupControlContext as default, useToggleGroupControlContext }; //# sourceMappingURL=context.mjs.map