UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
Add Comic Text component (#722)
Barath Kumaree85a3adb097
diff --git a/__registry__/index.tsx b/__registry__/index.tsxindex 9b7d0105..1fe52065 100644--- a/__registry__/index.tsx+++ b/__registry__/index.tsx@@ -1103,6 +1103,29 @@ export const Index: Record<string, any> = {}),meta: undefined,},+ "comic-text": {+ name: "comic-text",+ description: "Comic text animation",+ type: "registry:ui",+ registryDependencies: undefined,+ files: [+ {+ path: "registry/magicui/comic-text.tsx",+ type: "registry:ui",+ target: "components/magicui/comic-text.tsx",+ },+ ],+ component: React.lazy(async () => {+ const mod = await import("@/registry/magicui/comic-text.tsx");+ const exportName =+ Object.keys(mod).find(+ (key) =>+ typeof mod[key] === "function" || typeof mod[key] === "object",+ ) || item.name;+ return { default: mod.default || mod[exportName] };+ }),+ meta: undefined,+ },"icon-cloud": {name: "icon-cloud",description: "An interactive 3D tag cloud component",@@ -3465,6 +3488,29 @@ export const Index: Record<string, any> = {}),meta: undefined,},+ "comic-text-demo": {+ name: "comic-text-demo",+ description: "Example showing comic text animation.",+ type: "registry:example",+ registryDependencies: ["https://magicui.design/r/comic-text"],+ files: [+ {+ path: "registry/example/comic-text-demo.tsx",+ type: "registry:example",+ target: "components/comic-text-demo.tsx",+ },+ ],+ component: React.lazy(async () => {+ const mod = await import("@/registry/example/comic-text-demo.tsx");+ const exportName =+ Object.keys(mod).find(+ (key) =>+ typeof mod[key] === "function" || typeof mod[key] === "object",+ ) || item.name;+ return { default: mod.default || mod[exportName] };+ }),+ meta: undefined,+ },"icon-cloud-demo": {name: "icon-cloud-demo",description: "Example showing an interactive 3D icon cloud.",diff --git a/config/docs.ts b/config/docs.tsindex 05a9478d..5eda4a0e 100644--- a/config/docs.ts+++ b/config/docs.ts@@ -472,6 +472,12 @@ export const docsConfig: DocsConfig = {items: [],label: "",},+ {+ title: "Comic Text",+ href: `/docs/components/comic-text`,+ items: [],+ label: "New",+ },],},{diff --git a/content/docs/components/comic-text.mdx b/content/docs/components/comic-text.mdxnew file mode 100644index 00000000..5440f5fe--- /dev/null+++ b/content/docs/components/comic-text.mdx@@ -0,0 +1,64 @@+---+title: Comic Text+date: 2025-07-15+description: Comic text animation that looks like a comic book text+author: iambharathpadhu+published: true+---++<ComponentPreview name="comic-text-demo" />++## Installation++<Tabs defaultValue="cli">++<TabsList>+ <TabsTrigger value="cli">CLI</TabsTrigger>+ <TabsTrigger value="manual">Manual</TabsTrigger>+</TabsList>+<TabsContent value="cli">++```bash+npx shadcn@latest add "https://magicui.design/r/comic-text"+```++</TabsContent>++<TabsContent value="manual">++<Steps>++<Step>Copy and paste the following code into your project.</Step>++<ComponentSource name="comic-text" />++<Step>Update the import paths to match your project setup.</Step>++</Steps>++</TabsContent>++</Tabs>++## Usage++```tsx+import { ComicText } from "@/components/magicui/comic-text";+```++```tsx+<ComicText>Comic Text</ComicText>+```++## Props++| Prop | Type | Default | Description |+| ----------- | --------------- | --------- | --------------------------------------------- |+| `className` | `string` | `-` | The class name to be applied to the component |+| `fontSize` | `number` | `4` | The font size of the text |+| `style` | `CSSProperties` | `#ffffff` | The style of the text |+| `children` | `string` | `-` | The text to be displayed |++## Credits++- Credit to [@iambharathpadhu](https://github.com/iambharathpadhu)diff --git a/public/r/comic-text-demo.json b/public/r/comic-text-demo.jsonnew file mode 100644index 00000000..7782df49--- /dev/null+++ b/public/r/comic-text-demo.json@@ -0,0 +1,18 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "comic-text-demo",+ "type": "registry:example",+ "title": "Comic Text Demo",+ "description": "Example showing comic text animation.",+ "registryDependencies": [+ "https://magicui.design/r/comic-text"+ ],+ "files": [+ {+ "path": "registry/example/comic-text-demo.tsx",+ "content": "import { ComicText } from \"@/registry/magicui/comic-text\";\n\nexport default function ComicTextDemo() {\n return (\n <div className=\"space-y-8 text-center\">\n <ComicText fontSize={5}> \n BOOM!\n </ComicText>\n </div>\n );\n}\n",+ "type": "registry:example",+ "target": "components/comic-text-demo.tsx"+ }+ ]+}\ No newline at end of filediff --git a/public/r/comic-text.json b/public/r/comic-text.jsonnew file mode 100644index 00000000..e284fa7b--- /dev/null+++ b/public/r/comic-text.json@@ -0,0 +1,18 @@+{+ "$schema": "https://ui.shadcn.com/schema/registry-item.json",+ "name": "comic-text",+ "type": "registry:ui",+ "title": "Comic Text",+ "description": "Comic text animation",+ "dependencies": [+ "motion"+ ],+ "files": [+ {+ "path": "registry/magicui/comic-text.tsx",+ "content": "\"use client\";\nimport { cn } from \"@/lib/utils\";\nimport { motion } from \"motion/react\";\nimport { CSSProperties } from \"react\";\n\ntype ComicTextProps = {\n children: string;\n className?: string;\n style?: CSSProperties;\n fontSize?: number;\n};\n\nexport function ComicText({\n children,\n className,\n style,\n fontSize = 5,\n}: ComicTextProps) {\n if (typeof children !== \"string\") {\n throw new Error(\"children must be a string\");\n }\n\n return (\n <motion.div\n className={cn(\n \"select-none text-center\",\n className\n )}\n style={{\n fontSize: `${fontSize}rem`,\n fontFamily: \"'Bangers', 'Comic Sans MS', 'Impact', sans-serif\",\n fontWeight: \"900\",\n WebkitTextStroke: `${fontSize * 0.35}px #000000`, // Thick black outline\n transform: \"skewX(-10deg)\",\n textTransform: \"uppercase\",\n filter: `\n drop-shadow(5px 5px 0px #000000) \n drop-shadow(3px 3px 0px #B71C1C)\n `,\n backgroundColor: \"#FDE601\",\n backgroundImage:\n \"radial-gradient(circle at 1px 1px, #B71C1C 1px, transparent 0)\",\n backgroundSize: \"8px 8px\",\n backgroundClip: \"text\",\n WebkitBackgroundClip: \"text\",\n WebkitTextFillColor: \"transparent\",\n ...style,\n }}\n initial={{ opacity: 0, scale: 0.8, rotate: -2 }}\n animate={{ opacity: 1, scale: 1, rotate: 0 }}\n transition={{ \n duration: 0.6, \n ease: [0.175, 0.885, 0.32, 1.275],\n type: \"spring\"\n }}\n >\n {children}\n </motion.div>\n );\n}\n",+ "type": "registry:ui",+ "target": "components/magicui/comic-text.tsx"+ }+ ]+}\ No newline at end of filediff --git a/public/registry.json b/public/registry.jsonindex 09140e7d..70f3bde9 100644--- a/public/registry.json+++ b/public/registry.json@@ -905,6 +905,22 @@}]},+ {+ "name": "comic-text",+ "type": "registry:ui",+ "title": "Comic Text",+ "description": "Comic text animation",+ "dependencies": [+ "motion"+ ],+ "files": [+ {+ "path": "registry/magicui/comic-text.tsx",+ "type": "registry:ui",+ "target": "components/magicui/comic-text.tsx"+ }+ ]+ },{"name": "icon-cloud","type": "registry:ui",@@ -2575,6 +2591,22 @@}]},+ {+ "name": "comic-text-demo",+ "type": "registry:example",+ "title": "Comic Text Demo",+ "description": "Example showing comic text animation.",+ "registryDependencies": [+ "https://magicui.design/r/comic-text"+ ],+ "files": [+ {+ "path": "registry/example/comic-text-demo.tsx",+ "type": "registry:example",+ "target": "components/comic-text-demo.tsx"+ }+ ]+ },{"name": "icon-cloud-demo","type": "registry:example",diff --git a/registry.json b/registry.jsonindex 09140e7d..70f3bde9 100644--- a/registry.json+++ b/registry.json@@ -905,6 +905,22 @@}]},+ {+ "name": "comic-text",+ "type": "registry:ui",+ "title": "Comic Text",+ "description": "Comic text animation",+ "dependencies": [+ "motion"+ ],+ "files": [+ {+ "path": "registry/magicui/comic-text.tsx",+ "type": "registry:ui",+ "target": "components/magicui/comic-text.tsx"+ }+ ]+ },{"name": "icon-cloud","type": "registry:ui",@@ -2575,6 +2591,22 @@}]},+ {+ "name": "comic-text-demo",+ "type": "registry:example",+ "title": "Comic Text Demo",+ "description": "Example showing comic text animation.",+ "registryDependencies": [+ "https://magicui.design/r/comic-text"+ ],+ "files": [+ {+ "path": "registry/example/comic-text-demo.tsx",+ "type": "registry:example",+ "target": "components/comic-text-demo.tsx"+ }+ ]+ },{"name": "icon-cloud-demo","type": "registry:example",diff --git a/registry/example/comic-text-demo.tsx b/registry/example/comic-text-demo.tsxnew file mode 100644index 00000000..29d6dd1e--- /dev/null+++ b/registry/example/comic-text-demo.tsx@@ -0,0 +1,9 @@+import { ComicText } from "@/registry/magicui/comic-text";++export default function ComicTextDemo() {+ return (+ <div className="space-y-8 text-center">+ <ComicText fontSize={5}>BOOM!</ComicText>+ </div>+ );+}diff --git a/registry/magicui/comic-text.tsx b/registry/magicui/comic-text.tsxnew file mode 100644index 00000000..01e4554c--- /dev/null+++ b/registry/magicui/comic-text.tsx@@ -0,0 +1,59 @@+"use client";+import { cn } from "@/lib/utils";+import { motion } from "motion/react";+import { CSSProperties } from "react";++type ComicTextProps = {+ children: string;+ className?: string;+ style?: CSSProperties;+ fontSize?: number;+};++export function ComicText({+ children,+ className,+ style,+ fontSize = 5,+}: ComicTextProps) {+ if (typeof children !== "string") {+ throw new Error("children must be a string");+ }++ const dotColor = "#EF4444";+ const backgroundColor = "#FACC15";++ return (+ <motion.div+ className={cn("select-none text-center", className)}+ style={{+ fontSize: `${fontSize}rem`,+ fontFamily: "'Bangers', 'Comic Sans MS', 'Impact', sans-serif",+ fontWeight: "900",+ WebkitTextStroke: `${fontSize * 0.35}px #000000`, // Thick black outline+ transform: "skewX(-10deg)",+ textTransform: "uppercase",+ filter: `+ drop-shadow(5px 5px 0px #000000)+ drop-shadow(3px 3px 0px ${dotColor})+ `,+ backgroundColor: backgroundColor,+ backgroundImage: `radial-gradient(circle at 1px 1px, ${dotColor} 1px, transparent 0)`,+ backgroundSize: "8px 8px",+ backgroundClip: "text",+ WebkitBackgroundClip: "text",+ WebkitTextFillColor: "transparent",+ ...style,+ }}+ initial={{ opacity: 0, scale: 0.8, rotate: -2 }}+ animate={{ opacity: 1, scale: 1, rotate: 0 }}+ transition={{+ duration: 0.6,+ ease: [0.175, 0.885, 0.32, 1.275],+ type: "spring",+ }}+ >+ {children}+ </motion.div>+ );+}diff --git a/registry/registry-examples.ts b/registry/registry-examples.tsindex 5d1a3215..a1c1e5f6 100644--- a/registry/registry-examples.ts+++ b/registry/registry-examples.ts@@ -1116,6 +1116,20 @@ export const examples: Registry["items"] = [},],},+ {+ name: "comic-text-demo",+ type: "registry:example",+ title: "Comic Text Demo",+ description: "Example showing comic text animation.",+ registryDependencies: ["https://magicui.design/r/comic-text"],+ files: [+ {+ path: "registry/example/comic-text-demo.tsx",+ type: "registry:example",+ target: "components/comic-text-demo.tsx",+ },+ ],+ },{name: "icon-cloud-demo",type: "registry:example",diff --git a/registry/registry-ui.ts b/registry/registry-ui.tsindex d9b99a56..58259ed6 100644--- a/registry/registry-ui.ts+++ b/registry/registry-ui.ts@@ -854,6 +854,20 @@ export const ui: Registry["items"] = [},],},+ {+ name: "comic-text",+ type: "registry:ui",+ title: "Comic Text",+ description: "Comic text animation",+ dependencies: ["motion"],+ files: [+ {+ path: "registry/magicui/comic-text.tsx",+ type: "registry:ui",+ target: "components/magicui/comic-text.tsx",+ },+ ],+ },{name: "icon-cloud",type: "registry:ui",