UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
feat: add animated gradient pill
Dillion Vermae00a5f0fbab4
diff --git a/components/ui/separator.tsx b/components/ui/separator.tsxindex 9ac3b95f..3cc446d2 100644--- a/components/ui/separator.tsx+++ b/components/ui/separator.tsx@@ -1,7 +1,7 @@"use client";-import * as React from "react";import * as SeparatorPrimitive from "@radix-ui/react-separator";+import * as React from "react";import { cn } from "@/lib/utils";diff --git a/config/docs.ts b/config/docs.tsindex 92303987..59984478 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -169,6 +169,12 @@ export const docsConfig: DocsConfig = {href: `/docs/components/globe`,items: [],},+ {+ title: "Animated Gradient Pill",+ href: `/docs/components/animated-gradient-pill`,+ items: [],+ label: "New",+ },],},diff --git a/content/docs/components/animated-gradient-pill.mdx b/content/docs/components/animated-gradient-pill.mdxnew file mode 100644index 00000000..aafd646d--- /dev/null+++ b/content/docs/components/animated-gradient-pill.mdx@@ -0,0 +1,51 @@+---+title: Animated Gradient Pill+date: 2024-04-09+description: An animated gradient background which transitions between colors for text.+author: dillionverma+published: true+video: https://cdn.magicui.design/animated-gradient-pill.mp4+---++<ComponentPreview name="animated-gradient-pill-demo" />++<Steps>++### Installation++Copy and paste the following code into your project.++```js+// tailwind.config.js+module.exports = {+ theme: {+ extend: {+ animation: {+ gradient: "gradient 8s linear infinite",+ },+ keyframes: {+ gradient: {+ to: {+ backgroundPosition: "var(--bg-size) 0",+ },+ },+ },+ },+ },+};+```++```text+components/magicui/animated-gradient-pill.tsx+```++<ComponentSource name="animated-gradient-pill" />++</Steps>++## Props++| Prop | Type | Description | Default |+| ------------ | ------ | -------------------------------------------- | ------- |+| children | | The children passed into the component | |+| className | string | The class name to be applied to the shimmer. | |diff --git a/registry/components/example/animated-gradient-pill-demo.tsx b/registry/components/example/animated-gradient-pill-demo.tsxnew file mode 100644index 00000000..cda66f2e--- /dev/null+++ b/registry/components/example/animated-gradient-pill-demo.tsx@@ -0,0 +1,21 @@+import { cn } from "@/lib/utils";+import AnimatedGradientPill from "@/registry/components/magicui/animated-gradient-pill";+import { ChevronRight } from "lucide-react";++export default async function AnimatedGradientPillDemo() {+ return (+ <div className="z-10 flex min-h-[16rem] items-center justify-center">+ <AnimatedGradientPill>+ 🎉 <hr className="mx-2 h-4 w-[1px] shrink-0 bg-border" />{" "}+ <span+ className={cn(+ `inline animate-gradient bg-gradient-to-r from-[#ffaa40] via-[#9c40ff] to-[#ffaa40] bg-[length:var(--bg-size)_100%] bg-clip-text text-transparent`,+ )}+ >+ Introducing Magic UI+ </span>+ <ChevronRight className="ml-1 h-4 w-4 text-gray-500" />+ </AnimatedGradientPill>+ </div>+ );+}diff --git a/registry/components/magicui/animated-gradient-pill.tsx b/registry/components/magicui/animated-gradient-pill.tsxnew file mode 100644index 00000000..e404fa58--- /dev/null+++ b/registry/components/magicui/animated-gradient-pill.tsx@@ -0,0 +1,22 @@+import { ReactNode } from "react";++export default function AnimatedGradientPill({+ children,+}: {+ children: ReactNode;+}) {+ return (+ <a+ href="/"+ className={+ "relative mx-auto flex max-w-fit flex-row items-center justify-center rounded-2xl px-4 py-1.5 text-sm font-medium shadow-[inset_0_-8px_10px_#8fdfff1f] transition-shadow duration-500 ease-out [--bg-size:300%] hover:shadow-[inset_0_-5px_10px_#8fdfff3f]"+ }+ >+ <div+ className={`absolute inset-0 block h-full w-full animate-gradient bg-gradient-to-r from-[#ffaa40]/50 via-[#9c40ff]/50 to-[#ffaa40]/50 bg-[length:var(--bg-size)_100%] p-[1px] ![mask-composite:subtract] [border-radius:inherit] [mask:linear-gradient(#fff_0_0)_content-box,linear-gradient(#fff_0_0)]`}+ />++ {children}+ </a>+ );+}diff --git a/registry/index.tsx b/registry/index.tsxindex ba79ae82..9aec4b08 100644--- a/registry/index.tsx+++ b/registry/index.tsx@@ -122,6 +122,11 @@ const ui: Registry = {type: "components:ui",files: ["registry/components/magicui/text-reveal.tsx"],},+ "animated-gradient-pill": {+ name: "animated-gradient-pill",+ type: "components:ui",+ files: ["registry/components/magicui/animated-gradient-pill.tsx"],+ },};const example: Registry = {@@ -514,6 +519,14 @@ const example: Registry = {() => import("@/registry/components/example/text-reveal-demo"),),},+ "animated-gradient-pill-demo": {+ name: "animated-gradient-pill-demo",+ type: "components:example",+ files: ["registry/components/example/animated-gradient-pill-demo.tsx"],+ component: React.lazy(+ () => import("@/registry/components/example/animated-gradient-pill-demo"),+ ),+ },};const blocks: Registry = {