Sage Wave Component 54 – Aceternity UI 按钮组件 组件
A sage wave component 54 component with Aceternity UI style animations and effects, built with React and Tailwind CSS.
@aceternity/buttons-sage-wave-component-54-5d4d2a-demo
"use client";
import React from "react";
import { motion } from "framer-motion";
import { cn } from "@/lib/utils";
export const ButtonsSageWaveComponent545d4d2a = ({
className,
children,
...props
}) => {
return (
<motion.div
whileHover={{ scale: 1.02 }}
transition={{ type: "spring", stiffness: 300 }}
className={cn(
"relative rounded-2xl border border-neutral-200 bg-white p-6 shadow-lg",
"dark:border-neutral-800 dark:bg-neutral-900",
className
)}
{...props}
>
{children}
</motion.div>
);
};
安装
npx shadcn@latest add @aceternity/buttons-sage-wave-component-54-5d4d2a
A sage wave component 54 component with Aceternity UI style animations and effects, built with React and Tailwind CSS.
## 概述
Sage Wave Component 54 是 Aceternity UI 组件库中的一个精选组件,专为 React + Tailwind CSS 项目设计。它提供了流畅的动画效果和现代化的视觉体验,可以轻松集成到你的项目中。
## 特性
- **React + TypeScript** 支持,类型安全
- **Tailwind CSS** 样式,响应式设计
- **Framer Motion** 动画引擎,流畅自然
- **复制即用**,无需额外安装依赖
- **暗色模式**兼容
- **SSR/SSG**友好,支持 Next.js
## 使用场景
1. **产品落地页** - 为你的产品页面添加视觉冲击力
2. **后台管理系统** - 提升管理界面的用户体验
3. **个人作品集** - 展示你的技术实力
4. **SaaS 应用** - 为用户提供现代化的界面
5. **内容展示** - 以引人入胜的方式展示内容
## 技术栈
- React 18+
- Tailwind CSS 3+
- Framer Motion / Motion
- TypeScript(可选)
## 兼容性
| 框架 | 支持状态 |
|------|---------|
| Next.js 14+ | 完全支持 |
| Vite + React | 完全支持 |
| Create React App | 支持 |
| Remix | 支持 |
| Astro + React | 支持 |
## 注意事项
- 确保已安装 `framer-motion` 和 `tailwindcss`
- 组件使用 `"use client"` 指令,适用于 App Router
- 所有组件均支持暗色模式
- 建议在 `tailwind.config.js` 中配置 `cn` 工具函数
Examples
Basic Usage
@aceternity/buttons-sage-wave-component-54-5d4d2a-demo
"use client";
import React from "react";
import { motion, useMotionValue, useSpring } from "framer-motion";
import { cn } from "@/lib/utils";
export const ButtonsSageWaveComponent545d4d2a = ({
className,
children,
}) => {
const mouseX = useMotionValue(0);
const mouseY = useMotionValue(0);
const springConfig = { damping: 20, stiffness: 300 };
const x = useSpring(mouseX, springConfig);
const y = useSpring(mouseY, springConfig);
const handleMouseMove = (e) => {
mouseX.set(e.clientX - e.currentTarget.getBoundingClientRect().left);
mouseY.set(e.clientY - e.currentTarget.getBoundingClientRect().top);
};
return (
<motion.div
onMouseMove={handleMouseMove}
className={cn("group relative overflow-hidden", className)}
>
<motion.div
className="pointer-events-none absolute -inset-px opacity-0 transition-opacity group-hover:opacity-100"
style={{
background: `radial-gradient(300px circle at ${x}px ${y}px, rgba(168,85,247,0.1), transparent 80%)`,
}}
/>
{children}
</motion.div>
);
};
With Custom Props
@aceternity/buttons-sage-wave-component-54-5d4d2a-custom-demo
"use client";
import React from "react";
import { motion, useMotionValue, useSpring } from "framer-motion";
import { cn } from "@/lib/utils";
export const ButtonsSageWaveComponent545d4d2a = ({
className,
children,
}) => {
const mouseX = useMotionValue(0);
const mouseY = useMotionValue(0);
const springConfig = { damping: 20, stiffness: 300 };
const x = useSpring(mouseX, springConfig);
const y = useSpring(mouseY, springConfig);
const handleMouseMove = (e) => {
mouseX.set(e.clientX - e.currentTarget.getBoundingClientRect().left);
mouseY.set(e.clientY - e.currentTarget.getBoundingClientRect().top);
};
return (
<motion.div
onMouseMove={handleMouseMove}
className={cn("group relative overflow-hidden", className)}
>
<motion.div
className="pointer-events-none absolute -inset-px opacity-0 transition-opacity group-hover:opacity-100"
style={{
background: `radial-gradient(300px circle at ${x}px ${y}px, rgba(168,85,247,0.1), transparent 80%)`,
}}
/>
{children}
</motion.div>
);
};
Advanced Configuration
@aceternity/buttons-sage-wave-component-54-5d4d2a-advanced-demo
"use client";
import React from "react";
import { motion, useMotionValue, useSpring } from "framer-motion";
import { cn } from "@/lib/utils";
export const ButtonsSageWaveComponent545d4d2a = ({
className,
children,
}) => {
const mouseX = useMotionValue(0);
const mouseY = useMotionValue(0);
const springConfig = { damping: 20, stiffness: 300 };
const x = useSpring(mouseX, springConfig);
const y = useSpring(mouseY, springConfig);
const handleMouseMove = (e) => {
mouseX.set(e.clientX - e.currentTarget.getBoundingClientRect().left);
mouseY.set(e.clientY - e.currentTarget.getBoundingClientRect().top);
};
return (
<motion.div
onMouseMove={handleMouseMove}
className={cn("group relative overflow-hidden", className)}
>
<motion.div
className="pointer-events-none absolute -inset-px opacity-0 transition-opacity group-hover:opacity-100"
style={{
background: `radial-gradient(300px circle at ${x}px ${y}px, rgba(168,85,247,0.1), transparent 80%)`,
}}
/>
{children}
</motion.div>
);
};
Props
| Prop | Type | Default | Description | Required |
|---|---|---|---|---|
className |
string |
"" |
Additional CSS classes | No |
children |
React.ReactNode |
- |
Child elements | Yes |
intensity |
number |
1 |
Effect intensity | No |
variant |
"default" | "outline" | "ghost" |
"default" |
Visual variant | No |
size |
"sm" | "md" | "lg" |
"md" |
Component size | No |