Files
OpenFlare/frontend/components/animate-ui/primitives/buttons/button.tsx
T
2026-07-13 15:44:03 +08:00

36 lines
657 B
TypeScript

'use client';
import * as React from 'react';
import { type HTMLMotionProps, motion } from 'motion/react';
import {
Slot,
type WithAsChild,
} from '@/components/animate-ui/primitives/animate/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 };