Hoverable
Hoverable elements
import { Slot } from "@radix-ui/react-slot";
import React from "react";
import { cn } from "@/lib/utils";
import View, { type ViewProps } from "./view";
interface HoverableProps extends ViewProps {
asChild?: boolean;
enabled?: boolean;
}
const Hoverable = React.forwardRef<HTMLDivElement, HoverableProps>(
({ className, asChild = false, enabled = true, ...props }, ref) => {
const Comp = asChild ? Slot : View;
return (
<Comp
ref={ref}
className={cn({ "vision-pro-ui-hoverable": enabled }, className)}
{...props}
/>
);
}
);
Hoverable.displayName = "Hoverable";
export { Hoverable };
export type { HoverableProps };The Hoverable Component is a custom implementation of a hoverable element using React and Framer Motion. It provides a dynamic element that responds to user interactions and changes appearance based on the elements it hovers over.
API
| Prop | Type | Default |
|---|---|---|
propTypes? | any | - |
displayName? | string | - |
$$typeof | symbol | - |
Edit on GitHub
Last updated on