Button
A simple button that animates on hover and tap.
registry/primitives/button/index.tsx
"use client";
import * as React from "react";
import { motion, type HTMLMotionProps } from "motion/react";
import { Slot, type WithAsChild } from "@/components/unlumen-ui/primitives/slot";
type ButtonProps = WithAsChild<
HTMLMotionProps<"button"> & {
hoverScale?: number;
tapScale?: number;
}
>;
function Button({
hoverScale = 1.05,
tapScale = 0.95,
asChild = false,
...props
}: ButtonProps) {
const Component = asChild ? Slot : motion.button;
return (
<Component
whileTap={{ scale: tapScale }}
whileHover={{ scale: hoverScale }}
{...props}
/>
);
}
export { Button, type ButtonProps };
No selection tags yet — empty means no evidence, not lack of support.
DependenciesBundle weight · medium
- animation
- motion