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.
13 lines (12 loc) • 476 B
JavaScript
import { createInjectionState } from "@vueuse/core";
const TooltipStoreKey = "tooltip-store";
const [useProvideTooltip, useInjectTooltip] = createInjectionState((color) => {
return { color };
}, { injectionKey: TooltipStoreKey });
function useTooltip() {
const drawerState = useInjectTooltip();
if (!drawerState)
throw new Error("useTooltip must be used within a <Tooltip /> Component");
return drawerState;
}
export { useProvideTooltip, useTooltip };