UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
feat: gradual-spacing added (#59)
Abhishek Singhaf6b844374f9
diff --git a/config/docs.ts b/config/docs.tsindex 977ce438..86b0b174 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -207,6 +207,12 @@ export const docsConfig: DocsConfig = {items: [],label: "New",},+ {+ title: "Gradual Spacing",+ href: `/docs/components/gradual-spacing`,+ items: [],+ label: "New",+ },],},{diff --git a/content/docs/components/gradual-spacing.mdx b/content/docs/components/gradual-spacing.mdxnew file mode 100644index 00000000..44f6ee08--- /dev/null+++ b/content/docs/components/gradual-spacing.mdx@@ -0,0 +1,33 @@+---+title: Gradual Spacing+date: 2024-05-25+description: Word animation for gradual spacing between letters+author: wellitsabhi+published: true+---++<ComponentPreview name="gradual-spacing-demo" />++<Steps>++### Installation++Copy and paste the following code into your project.++```text+components/magicui/gradual-spacing.tsx+```++<ComponentSource name="gradual-spacing" />++</Steps>++## Props++| Prop | Type | Description | Default |+| ------------- | --------------- | -------------------------------------------------- | ------- |+| className | string | The class name to be applied to the component | |+| duration | number | The class name to be applied to the shimmer. | 0.5 |+| delayMultiple | number | The class name to be applied to the shimmer. | 0.1 |+| text | string | An array of words to rotate through | "" |+| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |\ No newline at end of filediff --git a/registry/components/example/gradual-spacing-demo.tsx b/registry/components/example/gradual-spacing-demo.tsxnew file mode 100644index 00000000..4bea614c--- /dev/null+++ b/registry/components/example/gradual-spacing-demo.tsx@@ -0,0 +1,10 @@+import GradualSpacing from "@/registry/components/magicui/gradual-spacing";++export default async function GradualSpacingDemo() {+ return (+ <GradualSpacing+ className="font-display text-center text-4xl font-bold tracking-[-0.1em] text-black dark:text-white md:text-7xl md:leading-[5rem]"+ text="Gradual Spacing"+ />+ );+}diff --git a/registry/components/magicui/gradual-spacing.tsx b/registry/components/magicui/gradual-spacing.tsxnew file mode 100644index 00000000..3157f248--- /dev/null+++ b/registry/components/magicui/gradual-spacing.tsx@@ -0,0 +1,43 @@+"use client";++import { cn } from "@/lib/utils";+import { AnimatePresence, Variants, motion } from "framer-motion";++interface GradualSpacingProps {+ text: string;+ duration?: number;+ delayMultiple?: number;+ framerProps?: Variants;+ className?: string;+}++export default function GradualSpacing({+ text,+ duration = 0.5,+ delayMultiple = 0.04,+ framerProps = {+ hidden: { opacity: 0, x: -20 },+ visible: { opacity: 1, x: 0 },+ },+ className,+}: GradualSpacingProps) {+ return (+ <div className="flex justify-center space-x-1">+ <AnimatePresence>+ {text.split("").map((char, i) => (+ <motion.h1+ key={i}+ initial="hidden"+ animate="visible"+ exit="hidden"+ variants={framerProps}+ transition={{ duration, delay: i * delayMultiple }}+ className={cn("drop-shadow-sm ", className)}+ >+ {char === " " ? <span> </span> : char}+ </motion.h1>+ ))}+ </AnimatePresence>+ </div>+ );+}diff --git a/registry/index.tsx b/registry/index.tsxindex 0642afc9..26b50bb6 100644--- a/registry/index.tsx+++ b/registry/index.tsx@@ -187,6 +187,11 @@ const ui: Registry = {type: "components:ui",files: ["registry/components/magicui/icon-cloud.tsx"],},+ "gradual-spacing": {+ name: "gradual-spacing",+ type: "components:ui",+ files: ["registry/components/magicui/gradual-spacing.tsx"],+ },};const example: Registry = {@@ -690,6 +695,14 @@ const example: Registry = {() => import("@/registry/components/example/icon-cloud-demo"),),},+ "gradual-spacing-demo": {+ name: "gradual-spacing-demo",+ type: "components:example",+ files: ["registry/components/example/gradual-spacing-demo.tsx"],+ component: React.lazy(+ () => import("@/registry/components/example/gradual-spacing-demo"),+ ),+ },};export const registry: Registry = {...ui,