-
Notifications
You must be signed in to change notification settings - Fork 574
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: line shadow text component added
- Loading branch information
1 parent
2f4cadd
commit 673790c
Showing
10 changed files
with
193 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
title: Line Shadow Text | ||
date: 2025-01-11 | ||
description: A line shadow text component for Magic UI | ||
author: magicui | ||
published: true | ||
--- | ||
|
||
<ComponentPreview name="line-shadow-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/line-shadow-text" | ||
``` | ||
|
||
</TabsContent> | ||
|
||
<TabsContent value="manual"> | ||
|
||
<Steps> | ||
|
||
<Step>Copy and paste the following code into your project.</Step> | ||
|
||
<ComponentSource name="line-shadow-text" /> | ||
|
||
<Step>Update the import paths to match your project setup.</Step> | ||
|
||
<Step>Update `tailwind.config.js`</Step> | ||
|
||
Add the following animations to your `tailwind.config.js` file: | ||
|
||
```js title="tailwind.config.js" {5-14} | ||
/** @type {import('tailwindcss').Config} */ | ||
module.exports = { | ||
theme: { | ||
extend: { | ||
animation: { | ||
"line-shadow": "line-shadow 15s linear infinite", | ||
}, | ||
keyframes: { | ||
"line-shadow": { | ||
"0%": { "background-position": "0 0" }, | ||
"100%": { "background-position": "100% -100%" }, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}; | ||
``` | ||
|
||
</Steps> | ||
|
||
</TabsContent> | ||
|
||
</Tabs> | ||
|
||
## Props | ||
|
||
| Prop | Type | Default | Description | | ||
| ----------- | ------ | ---------- | ------------------------------------------- | | ||
| text | string | `"SHADOW"` | The text to display with shadow effect | | ||
| shadowColor | string | `"black"` | The color of the shadow effect | | ||
| className | string | `-` | Additional CSS classes to apply to the text | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"name": "line-shadow-text", | ||
"type": "registry:ui", | ||
"files": [ | ||
{ | ||
"path": "magicui/line-shadow-text.tsx", | ||
"content": "\"use client\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport function LineShadowText({\n text = \"SHADOW\",\n shadowColor = \"black\",\n className,\n}: {\n text?: string;\n shadowColor?: string;\n className?: string;\n}) {\n return (\n <span\n style={{ \"--shadow-color\": shadowColor } as React.CSSProperties}\n className={cn(\n \"relative inline-flex\",\n\n // positioning\n \"after:absolute after:left-[0.04em] after:top-[0.04em] after:content-[attr(data-text)]\",\n\n // color\n \"after:bg-[linear-gradient(45deg,transparent_45%,var(--shadow-color)_45%,var(--shadow-color)_55%,transparent_0)]\",\n\n // text\n \"after:bg-[length:0.06em_0.06em] after:bg-clip-text after:text-transparent\",\n\n // animation\n \"after:animate-line-shadow\",\n\n className,\n )}\n data-text={text}\n >\n {text}\n </span>\n );\n}\n", | ||
"type": "registry:ui", | ||
"target": "" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LineShadowText } from "@/registry/default/magicui/line-shadow-text"; | ||
export default function LineShadowTextDemo() { | ||
return ( | ||
<h1 className="text-balance text-5xl font-semibold leading-none tracking-tighter sm:text-6xl md:text-7xl lg:text-8xl"> | ||
Ship | ||
<LineShadowText | ||
text="Products" | ||
className="font-bold italic tracking-tighter" | ||
/> | ||
</h1> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
"use client"; | ||
|
||
import { cn } from "@/lib/utils"; | ||
|
||
export function LineShadowText({ | ||
text = "SHADOW", | ||
shadowColor = "black", | ||
className, | ||
}: { | ||
text?: string; | ||
shadowColor?: string; | ||
className?: string; | ||
}) { | ||
return ( | ||
<span | ||
style={{ "--shadow-color": shadowColor } as React.CSSProperties} | ||
className={cn( | ||
"relative inline-flex", | ||
|
||
// positioning | ||
"after:absolute after:left-[0.04em] after:top-[0.04em] after:content-[attr(data-text)]", | ||
|
||
// color | ||
"after:bg-[linear-gradient(45deg,transparent_45%,var(--shadow-color)_45%,var(--shadow-color)_55%,transparent_0)]", | ||
|
||
// text | ||
"after:bg-[length:0.06em_0.06em] after:bg-clip-text after:text-transparent", | ||
|
||
// animation | ||
"after:animate-line-shadow", | ||
|
||
className, | ||
)} | ||
data-text={text} | ||
> | ||
{text} | ||
</span> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters