Skip to content

UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.

Add Word Pull Up component (#40)

Gökhan Öztürk9207031a92d3
diff --git a/config/docs.ts b/config/docs.ts
index d42cd09f..133247dc 100644
--- a/config/docs.ts
+++ b/config/docs.ts
@@ -193,6 +193,12 @@ export const docsConfig: DocsConfig = {
items: [],
label: "New",
},
+ {
+ title: "Word Pull Up",
+ href: `/docs/components/word-pull-up`,
+ items: [],
+ label: "New",
+ },
],
},
{
diff --git a/content/docs/components/word-pull-up.mdx b/content/docs/components/word-pull-up.mdx
new file mode 100644
index 00000000..426b0e86
--- /dev/null
+++ b/content/docs/components/word-pull-up.mdx
@@ -0,0 +1,32 @@
+---
+title: Word Pull Up
+date: 2024-05-23
+description: Text animation for words to pull up
+author: gokh4nozturk
+published: true
+---
+
+<ComponentPreview name="word-pull-up-demo" />
+
+<Steps>
+
+### Installation
+
+Copy and paste the following code into your project.
+
+```text
+components/magicui/word-pull-up-demo.tsx
+```
+
+<ComponentSource name="word-pull-up-demo" />
+
+</Steps>
+
+## Props
+
+| Prop | Type | Description | Default |
+| ------------------ | --------------- | -------------------------------------------------- | ------- |
+| className | string | The class name to be applied to the component | |
+| words | string[] | An array of word to pull up | "" |
+| framerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
+| wrapperFramerProps | HTMLMotionProps | An object containing framer-motion animation props | {} |
diff --git a/registry/components/example/word-pull-up-demo.tsx b/registry/components/example/word-pull-up-demo.tsx
new file mode 100644
index 00000000..9843dc9a
--- /dev/null
+++ b/registry/components/example/word-pull-up-demo.tsx
@@ -0,0 +1,10 @@
+import WordPullUp from "@/registry/components/magicui/word-pull-up";
+
+export default async function WordPullUpDemo() {
+ return (
+ <WordPullUp
+ className="text-4xl font-bold tracking-[-0.02em] text-black dark:text-white md:text-7xl md:leading-[5rem]"
+ words="Word Pull Up"
+ />
+ );
+}
diff --git a/registry/components/magicui/word-pull-up.tsx b/registry/components/magicui/word-pull-up.tsx
new file mode 100644
index 00000000..bdab54bb
--- /dev/null
+++ b/registry/components/magicui/word-pull-up.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { motion, Variants } from "framer-motion";
+import { cn } from "lib/utils";
+
+interface WordPullUpProps {
+ words: string;
+ duration?: number;
+ delayMultiple?: number;
+ wrapperFramerProps?: Variants;
+ framerProps?: Variants;
+ className?: string;
+}
+
+export default function WordPullUp({
+ words,
+ wrapperFramerProps = {
+ hidden: { opacity: 0 },
+ show: {
+ opacity: 1,
+ transition: {
+ staggerChildren: 0.2,
+ },
+ },
+ },
+ framerProps = {
+ hidden: { y: 20, opacity: 0 },
+ show: { y: 0, opacity: 1 },
+ },
+ className,
+}: WordPullUpProps) {
+ return (
+ <motion.h1
+ variants={wrapperFramerProps}
+ initial="hidden"
+ animate="show"
+ className={cn(
+ "font-display text-center text-4xl font-bold tracking-[-0.02em] drop-shadow-sm md:text-7xl md:leading-[5rem]",
+ className,
+ )}
+ >
+ {words.split(" ").map((word, i) => (
+ <motion.span
+ key={i}
+ variants={framerProps}
+ style={{ display: "inline-block", paddingRight: "15px" }}
+ >
+ {word === "" ? <span>&nbsp;</span> : word}
+ </motion.span>
+ ))}
+ </motion.h1>
+ );
+}
diff --git a/registry/index.tsx b/registry/index.tsx
index fa1720f7..57a4585f 100644
--- a/registry/index.tsx
+++ b/registry/index.tsx
@@ -147,6 +147,11 @@ const ui: Registry = {
type: "components:ui",
files: ["registry/components/magicui/avatar-circles.tsx"],
},
+ "word-pull-up": {
+ name: "word-pull-up",
+ type: "components:ui",
+ files: ["registry/components/magicui/word-pull-up.tsx"],
+ },
"typing-animation": {
name: "typing-animation",
type: "components:ui",
@@ -603,6 +608,14 @@ const example: Registry = {
() => import("@/registry/components/example/avatar-circles-demo"),
),
},
+ "word-pull-up-demo": {
+ name: "word-pull-up-demo",
+ type: "components:example",
+ files: ["registry/components/example/word-pull-up-demo.tsx"],
+ component: React.lazy(
+ () => import("@/registry/components/example/word-pull-up-demo"),
+ ),
+ },
"typing-animation-demo": {
name: "typing-animation-demo",
type: "components:example",