Getting Started
Components
Special Effects
Animations
Text Animations
Backgrounds
A background striped pattern made with SVGs, fully customizable using Tailwind CSS.
striped-pattern.svelte
<script lang="ts"> import { StripedPattern } from "$lib/components/magic/striped-pattern/index.js";</script>
<div class="relative flex h-125 w-full flex-col items-center justify-center overflow-hidden rounded-lg border"> <StripedPattern class="mask-[radial-gradient(300px_circle_at_center,white,transparent)]" /></div>Installation
pnpm dlx shadcn-svelte@latest add https://sv-animations.vercel.app/r/striped-pattern.json
Copy the Source Code
Copy and paste the following code into your project:
striped-pattern.svelte
<script lang="ts"> import { cn } from "#lib/utils.js"; import type { ClassValue, SVGAttributes } from "svelte/elements";
interface Props extends SVGAttributes<SVGSVGElement> { direction?: "left" | "right"; class?: ClassValue; }
let { direction = "left", class: className, width = 10, height = 10, ...restProps }: Props = $props();
let id = $props.id(); let w = $derived(Number(width)); let h = $derived(Number(height));</script>
<svg aria-hidden="true" class={cn("pointer-events-none absolute inset-0 z-10 h-full w-full stroke-[0.5]", className)} xmlns="http://www.w3.org/2000/svg" {...restProps}> <defs> <pattern {id} width={w} height={h} patternUnits="userSpaceOnUse"> {#if 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" /> {:else} <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" /> {/if} </pattern> </defs> <rect width="100%" height="100%" fill={`url(#${id})`} /></svg> index.ts
import StripedPattern from "./striped-pattern.svelte";export { StripedPattern };Install and integrate the Svelte component documented below.https://sv-animations.vercel.app/magic/docs/components/striped-pattern/llms.txt
Follow the guide's installation and usage instructions.Match the project's existing structure, imports, and styles.Keep changes scoped to the component and verify it works.Reply with a short bullet list of completed changes.Usage
<script lang="ts"> import { StripedPattern } from "#lib/components/magic/striped-pattern/index.js";</script>
<div class="relative h-64 overflow-hidden"> <StripedPattern /></div>Props
A component for .
| Name | Type | Default | Description |
|---|---|---|---|
class | ClassValue | "" | Additional CSS classes to apply |
direction | "left" | "right" | "left" | Direction of the stripes |
width | number | 10 | Width of the pattern |
height | number | 10 | Height of the pattern |