Edge Light
A soft light sweeping around a surface's border while work is in progress.
"use client";
import { useState } from "react";
import { Button } from "../../button/components/button";
import { EdgeLight } from "../components/edge-light";
export default function EdgeLightExample() {
const [active, setActive] = useState(true);
return (
<div className="flex w-full max-w-xl flex-col items-start gap-3 p-6">
<div className="relative w-full rounded-[10px]">
<div className="border-table-card-border bg-table-card shadow-table-card text-muted-foreground h-24 rounded-[10px] border px-3 py-2.5 text-sm">
Writing this week's changelog...
</div>
<EdgeLight active={active} />
</div>
<Button
onClick={() => setActive((current) => !current)}
size="sm"
variant="outline"
>
{active ? "Stop" : "Start"}
</Button>
</div>
);
}
$ bunx --bun shadcn@latest add @notra/edge-lightThe Notra composer runs it while a reply streams. A soft light travels around the border, white on dark and black on light, and a few highlights along the edge catch it as it passes. It fades in when active turns on, fades out when it turns off, and leaves the page once it has faded.
Place it inside a positioned, rounded element the size of the surface. It takes that element’s radius and sits on top of the surface’s own border.
<div className="relative rounded-[10px]">
<div className="rounded-[10px] border">...</div>
<EdgeLight active={isStreaming} />
</div>
| Prop | Default | Description |
|---|---|---|
active |
Whether the light is travelling. | |
className |
Classes on the root, for example to set --edge-light-duration. |
Every moving part turns with transform, so the browser’s compositor runs it on its own, with no JavaScript, layout or paint on the main thread. A streaming reply keeps the main thread busy, and the light stays smooth through it. The rotating layers cost GPU memory, and only while the light runs. Reduced motion holds it still.