Horizontal Stripes
A decorative horizontal stripe pattern component using CSS repeating gradients.
Last updated on
A lightweight decorative component that renders a diagonal stripe pattern across the full width. Uses a --pattern CSS custom property for color, making it fully themeable.
Installation
npx shadcn@latest add @grenish/horizontal-stripesThis requires the @grenish registry in your components.json. See the installation guide for setup.
Usage
import HorizontalStripes from "@/components/tools/horizontal-stripes"
export default function Example() {
return <HorizontalStripes />
}import { cn } from "@/lib/utils";
type StripesProps = {
className?: string;
};
export default function HorizontalStripes({ className }: StripesProps) {
return (
<div
className={cn(
"h-10 w-full bg-[repeating-linear-gradient(-45deg,var(--pattern)_0,var(--pattern)_1px,transparent_0,transparent_50%)] bg-size-[10px_10px]",
`${className}`,
)}
/>
);
}Features
- CSS-only pattern — No images or SVGs, purely CSS repeating gradients.
- Themeable — Uses
--patternCSS variable for stripe color, adapts to any theme. - Customizable — Override dimensions, colors, and spacing via
className. - Lightweight — Zero dependencies beyond
cnutility.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
className | string | — | Additional CSS classes to apply. |
CSS Variable
The component uses the --pattern CSS custom property for the stripe color. Define it in your CSS:
:root {
--pattern: hsl(var(--border));
}Examples
Custom height and color
<HorizontalStripes className="h-20 [--pattern:hsl(var(--primary))]" />As a section divider
<div className="space-y-8">
<section>Content above</section>
<HorizontalStripes className="h-4" />
<section>Content below</section>
</div>Google Button
A styled authentication button for Google sign-in with icon and full variants, customizable tooltip, and seamless integration with shadcn Button.
Instagram Card
A versatile, responsive Instagram-style card component for showcasing user profiles with customizable photo galleries and multiple layout options.