keep-vue
Version:
Keep Vue is an open-source component library built on top of Vue3 and Tailwind CSS. It offers a collection of pre-designed UI components and styles that you can easily integrate into your web applications.
14 lines (13 loc) • 493 B
JavaScript
import { createInjectionState } from "@vueuse/core";
import {} from "vue";
const DrawerStoreKey = "drawer-store";
const [useProvideDrawer, useInjectDrawer] = createInjectionState((position) => {
return { position };
}, { injectionKey: DrawerStoreKey });
function useDrawer() {
const drawerState = useInjectDrawer();
if (!drawerState)
throw new Error("useDrawer must be used within a <Drawer /> Component");
return drawerState;
}
export { useDrawer, useProvideDrawer };