Ace UI
The ImageText component creates visually striking text by applying image backgrounds with CSS masking, perfect for hero sections, headings, and artistic typography effects
Installation
1npx shadcn@latest add "https://ace-ui-six.vercel.app/r/image-text.json"
Usage
1import { ImageText } from "@/components/ui/image-text";23export default function Example() {4return (5 <div>6 <ImageText text="AceUi" backgroundImage="/image-text.jpg" />7 </div>8);9}
Variants
1// Different font sizes2<ImageText3text="Large Title"4backgroundImage="/hero-bg.jpg"5fontSizeClasses="text-6xl md:text-8xl lg:text-9xl"6/>78// Custom alignment9<ImageText10text="Left Aligned"11backgroundImage="/texture.jpg"12align="left"13/>1415// Custom styling16<ImageText17text="Custom Style"18backgroundImage="/gradient.jpg"19fontWeight="font-black"20className="tracking-wider"21/>
Features
- Image background text masking effect
- Responsive font sizing with Tailwind classes
- Multiple text alignment options:
left,center,right
Notice
Make sure your background images are optimized and have good contrast with surrounding elements for better readability and performance.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
text | string | "Ace UI" | The text content to display |
backgroundImage | string | "/image-text.jpg" | Path to the background image |
fontSizeClasses | string | "text-4xl sm:text-6xl md:text-7xl lg:text-8xl" | Tailwind font size classes for responsive sizing |
fontWeight | string | "font-extrabold" | Tailwind font weight class |
align | 'left' | 'center' | 'right' | 'center' | Text alignment |
className | string | '' | Additional CSS classes |