Aurora Bars
unlumen-ui/aurora-barsFreeComponent
Animated bars with aurora-inspired gradient effects and smooth transitions.
Live preview
live · rendered by the registry
Rendered by Unlumen Ui on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://ui.unlumen.com/r/aurora-bars.jsonSource
1"use client";23import * as React from "react";4import { motion, useAnimationFrame } from "motion/react";56import { cn } from "@/lib/utils";78export interface AuroraBarsProps {9 /** @default 24 */10 barCount?: number;11 /** gradient color stops, bottom to top — @default ["#ff2d78", "#c04aff", "#4a6fff", "#0a1aff", "#00000000"] */12 colors?: string[];13 /** max bar height as fraction of container height — @default 0.92 */14 maxHeightRatio?: number;15 /** min bar height as fraction of container height — @default 0.18 */16 minHeightRatio?: number;17 /** undulation speed — @default 0.5 */18 speed?: number;19 /** @default 3 */20 gap?: number;21 /** px blur per bar, creates soft glow — @default 0 */22 blur?: number;23 /** @default "#000000" */24 background?: string;25 className?: string;26}2728/** two sine waves per bar for organic movement */29function barHeight(30 index: number,31 total: number,32 time: number,33 minH: number,34 maxH: number,35): number {36 // Arch envelope: tallest in the centre, shorter on edges37 // arch envelope: tallest in centre, shorter on edges38 const norm = index / (total - 1);39 const arch = Math.sin(norm * Math.PI);4041 const phase1 = (index / total) * Math.PI * 2;42 const phase2 = (index / total) * Math.PI * 5.3;4344 const wave =45 0.5 +46 0.25 * Math.sin(time * 1.1 + phase1) +47 0.25 * Math.sin(time * 0.7 + phase2);4849 const blended = arch * 0.65 + wave * 0.35;5051 return minH + blended * (maxH - minH);52}5354export function AuroraBars({55 barCount = 24,56 colors = ["#ffd6eb", "#ff9acb", "#ff5aa6", "#ff2d78", "#00000000"],57 maxHeightRatio = 0.92,58 minHeightRatio = 0.18,59 speed = 0.5,60 gap = 3,61 blur = 0,62 background = "#000000",63 className,64}: AuroraBarsProps) {65 const containerRef = React.useRef<HTMLDivElement>(null);66 const [heights, setHeights] = React.useState<number[]>(() =>67 Array.from({ length: barCount }, (_, i) =>68 barHeight(i, barCount, 0, minHeightRatio, maxHeightRatio),69 ),70 );7172 const timeRef = React.useRef(0);7374 useAnimationFrame((_, delta) => {75 timeRef.current += (delta / 1000) * speed;76 const t = timeRef.current;77 setHeights(78 Array.from({ length: barCount }, (_, i) =>79 barHeight(i, barCount, t, minHeightRatio, maxHeightRatio),80 ),81 );82 });8384 const gradientStop = colors85 .map((c, i) => `${c} ${Math.round((i / (colors.length - 1)) * 100)}%`)86 .join(", ");87 const gradient = `linear-gradient(to top, ${gradientStop})`;8889 return (90 <div91// … truncated
What it pulls in
npm packages
Files it writes
More from Unlumen Ui
All 233 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| AI Chatai-chat | Unlumen Ui | Components | Paid | 2 deps | |
| Vercel Animate Countanimate-count | Unlumen Ui | Components | Free | 1 dep | |
| Animate Digitsanimate-digits | Unlumen Ui | Components | Free | 1 dep | |
| Animated Inputanimate-text-input-typing | Unlumen Ui | Components | Paid | 1 dep | |
| Animated Listanimated-list | Unlumen Ui | Components | Free | 1 dep | |
| Apple Switchapple-switch | Unlumen Ui | Components | Free | 1 dep | |
| Aurora Bluraurora-blur | Unlumen Ui | Components | Free | 2 deps | |
| Aurora Cardaurora-card | Unlumen Ui | Components | Paid | 2 deps |
