Style Library
Striped Pattern
AnimationanimationA background striped pattern made with SVGs, fully customizable using Tailwind CSS.
Prompt
Paste into any AI assistant before describing what to build — or attach it to a project below.
# Animation pattern — Striped Pattern
A background striped pattern made with SVGs, fully customizable using Tailwind CSS.
Build it in React with `motion` (motion/react) and Tailwind CSS. Respect `prefers-reduced-motion` (render the final state without movement), keep it under ~400 ms for UI feedback, and animate only transform and opacity where possible.
Reference implementation (Magic UI, MIT):
```tsx
import React, { useId } from "react"
import { cn } from "@/lib/utils"
interface StripedPatternProps extends React.SVGProps<SVGSVGElement> {
direction?: "left" | "right"
}
export function StripedPattern({
direction = "left",
className,
width = 10,
height = 10,
...props
}: StripedPatternProps) {
const id = useId()
const w = Number(width)
const h = Number(height)
return (
<svg
aria-hidden="true"
className={cn(
"pointer-events-none absolute inset-0 z-10 h-full w-full stroke-[0.5]",
className
)}
xmlns="http://www.w3.org/2000/svg"
{...props}
>
<defs>
<pattern id={id} width={w} height={h} patternUnits="userSpaceOnUse">
{direction === "left" ? (
<>
<line x1="0" y1={h} x2={w} y2="0" stroke="currentColor" />
<line x1={-w} y1={h} x2="0" y2="0" stroke="currentColor" />
<line x1={w} y1={h} x2={w * 2} y2="0" stroke="currentColor" />
</>
) : (
<>
<line x1="0" y1="0" x2={w} y2={h} stroke="currentColor" />
<line x1={-w} y1="0" x2="0" y2={h} stroke="currentColor" />
<line x1={w} y1="0" x2={w * 2} y2={h} stroke="currentColor" />
</>
)}
</pattern>
</defs>
<rect width="100%" height="100%" fill={`url(#${id})`} />
</svg>
)
}
```Use it in an app
Create a free account to attach this style to a project: the hub adds it to the prompt your AI assistant gets, so it builds every page in this look.
From Magic UI (MIT, commit d7207e5).View source