Components
Banner
An auto-scrolling marquee banner with seamless looping, hover pause and direction control
Installation
- $npx litefy@latest add banner
- $pnpm dlx litefy@latest add banner
- $yarn dlx litefy@latest add banner
- $bun --bun litefy@latest add banner
Usage
A data-driven auto-scrolling announcement banner.
🎉 Litefy v2.0 is out — new Context Menu, Wizard and Banner components
📚 New composition guides: Combobox, Multi Select, Date Picker
🎨 12 brand themes with automatic surface tuning
"use client";
import { Banner } from "@/ui";
const messages = [
{
key: "release",
content: "🎉 Litefy v2.0 is out — new Context Menu, Wizard and Banner components",
},
{
key: "docs",
content: "📚 New composition guides: Combobox, Multi Select, Date Picker",
},
{
key: "theme",
content: "🎨 12 brand themes with automatic surface tuning",
},
];
export default function BannerBasicDemo() {
return (
<div className="w-full max-w-md overflow-hidden rounded-md">
<Banner
items={messages}
speed={20}
classNames={{ item: "gap-2 px-8 py-2 text-sm whitespace-nowrap" }}
/>
</div>
);
}
Custom
Assemble the parts manually — render two identical copies (the extra one aria-hidden) for the seamless loop.
Server maintenance Sunday 02:00 UTC
Banner component just landed
Anchor positioning powers every popover
"use client";
import { Megaphone, Sparkles, Zap } from "lucide-react";
import { BannerItem, BannerTrack, BannerViewport } from "@/ui";
const messages = [
{ icon: Megaphone, text: "Server maintenance Sunday 02:00 UTC" },
{ icon: Sparkles, text: "Banner component just landed" },
{ icon: Zap, text: "Anchor positioning powers every popover" },
];
export default function BannerCustomDemo() {
return (
<div className="w-full max-w-md rounded-md">
<BannerViewport
className="py-2 bg-primary text-primary-foreground"
aria-label="Announcements"
>
<BannerTrack duration={12} direction="right" playing>
{[0, 1].map((copy) => (
<div
key={copy}
aria-hidden={copy > 0 || undefined}
className="flex shrink-0 items-center"
>
{messages.map(({ icon: Icon, text }) => (
<BannerItem key={text} className="gap-2 px-6 text-sm">
<Icon className="size-3.5 text-primary" />
<span className="whitespace-nowrap">{text}</span>
</BannerItem>
))}
</div>
))}
</BannerTrack>
</BannerViewport>
</div>
);
}
API Reference
High-level Components
Banner
A data-driven marquee banner.
| Prop | Type | Default | Description |
|---|---|---|---|
items | BannerItem[] | - | The scrolling content; each item renders inside a BannerItem |
speed | number | 30 | Seconds per full loop (one -50% track shift) |
direction | "left" | "right" | left | Scroll direction |
pauseOnHover | boolean | true | Pause the animation while the pointer is over the banner |
className | ClassNameValue | - | Custom classes for the viewport strip |
style | React.CSSProperties | - | Inline styles for the viewport strip |
classNames | { track?; item? } — each ClassNameValue | - | Custom classes for the track and items |
styles | { track?; item? } — each React.CSSProperties | - | Inline styles for the track and items |
...props | React.ComponentProps<"div"> | - | Native div props spread on the viewport (except children); your own onMouseEnter / onMouseLeave compose with the hover pause |
BannerItem
A single scrolling entry.
| Field | Type | Description |
|---|---|---|
key | string | number | Optional React key |
content | React.ReactNode | The rendered content |
Statics
| Static | Type | Description |
|---|---|---|
Banner.Viewport | BannerViewport | The clipping container part |
Banner.Track | BannerTrack | The animated strip part |
Banner.Item | BannerItem | The single entry part |
Composable Components
BannerViewport
The clipping container.
| Prop | Type | Description |
|---|---|---|
className | ClassNameValue | Custom CSS class |
...props | React.ComponentProps<"div"> | Supports all native div props |
BannerTrack
The animated strip; for a seamless loop it must contain two identical halves (the -50% shift).
| Prop | Type | Default | Description |
|---|---|---|---|
duration | number | 30 | Seconds per full loop |
direction | "left" | "right" | left | Scroll direction |
playing | boolean | true | Plays or pauses the animation |
className | ClassNameValue | - | Custom CSS class (flex w-max built in) |
...props | React.ComponentProps<"div"> | - | Supports all native div props |
BannerItem
A single entry cell (flex shrink-0 items-center built in).
| Prop | Type | Description |
|---|---|---|
className | ClassNameValue | Custom CSS class |
...props | React.ComponentProps<"div"> | Supports all native div props |