BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/Sora UI/border-trail

Border Trail

sora-ui/border-trail
FreeComponent

Animated border spotlight that travels around a rounded container, powered by Motion.

Install it

npx shadcn@latest add https://ui.soralabs.io.vn/r/border-trail.json

Source

registry/primitives/effects/border-trail/index.tsxui.soralabs.io.vn/r/border-trail.json
1"use client";
2
3import { cn } from "@/lib/utils";
4import { motion, type Transition, useReducedMotion } from "motion/react";
5import { type CSSProperties, useEffect, useRef } from "react";
6
7export interface BorderTrailProps {
8 className?: string;
9 onAnimationComplete?: () => void;
10 size?: number;
11 style?: CSSProperties;
12 transition?: Transition;
13}
14
15const DEFAULT_TRANSITION: Transition = {
16 repeat: Number.POSITIVE_INFINITY,
17 duration: 5,
18 ease: "linear",
19};
20
21function getReducedMotionCompletionMs(
22 duration: number,
23 delay: number,
24 repeat: number | undefined,
25 repeatDelay: number
26): number | null {
27 if (
28 repeat === Number.POSITIVE_INFINITY ||
29 repeat === Number.NEGATIVE_INFINITY
30 ) {
31 return null;
32 }
33
34 // Motion: repeat N = initial play + N additional iterations.
35 const iterationCount =
36 typeof repeat === "number" && repeat > 0 ? repeat + 1 : 1;
37 const betweenRepeatDelays =
38 typeof repeat === "number" && repeat > 0 ? repeat * repeatDelay : 0;
39
40 return (delay + duration * iterationCount + betweenRepeatDelays) * 1000;
41}
42
43export function BorderTrail({
44 className,
45 size = 60,
46 transition,
47 onAnimationComplete,
48 style,
49}: BorderTrailProps) {
50 const prefersReducedMotion = useReducedMotion();
51 const onAnimationCompleteRef = useRef(onAnimationComplete);
52 onAnimationCompleteRef.current = onAnimationComplete;
53
54 const resolvedTransition = { ...DEFAULT_TRANSITION, ...transition };
55 const duration =
56 typeof resolvedTransition.duration === "number"
57 ? resolvedTransition.duration
58 : 5;
59 const delay =
60 typeof resolvedTransition.delay === "number" ? resolvedTransition.delay : 0;
61 const repeat = resolvedTransition.repeat;
62 const repeatDelay =
63 typeof resolvedTransition.repeatDelay === "number"
64 ? resolvedTransition.repeatDelay
65 : 0;
66
67 useEffect(() => {
68 if (!prefersReducedMotion) {
69 return;
70 }
71
72 const completionMs = getReducedMotionCompletionMs(
73 duration,
74 delay,
75 repeat,
76 repeatDelay
77 );
78 if (completionMs === null) {
79 return;
80 }
81
82 const timeoutId = window.setTimeout(
83 () => onAnimationCompleteRef.current?.(),
84 completionMs
85 );
86 return () => window.clearTimeout(timeoutId);
87 }, [prefersReducedMotion, duration, delay, repeat, repeatDelay]);
88
89 if (prefersReducedMotion) {
90 // className/style style the small moving square (glow shadows, gradient
91 // fills sized for `size`px) — reusing them here would stretch a
92// … truncated

What it pulls in

npm packages

  • motion

Other registry items

  • utils

Files it writes

  • registry/primitives/effects/border-trail/index.tsx

Facts

Registry
Sora UI
Type
registry:ui
Access
Free
Files written
1
Licence
the repository states none
First indexed
2026-08-12
Last confirmed
today

Go to the source

ui.soralabs.io.vn Raw registry item This item as JSON

More from Sora UI

All 97 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
AccordionaccordionSora UIComponentsFree2 deps
Bottom Sheetbottom-sheetSora UIComponentsFree2 deps
Cursor Bubblecursor-bubbleSora UIComponentsFree2 deps
Cursor Trail Revealcursor-trail-revealSora UIComponentsFree1 dep
Custom Cursorcustom-cursorSora UIComponentsFree2 deps
Accordion Demodemo-accordionSora UIComponentsFreeno deps
Border Trail Demodemo-border-trailSora UIComponentsFreeno deps
Border Trail Loading Card Demodemo-border-trail-loadingSora UIComponentsFreeno deps
BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex

BlockDex

Built by

Kynth Studios

the studio behind StoreReady, ToolDrift and BreachProbe

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

© 2026 BlockDex. A Kynth Studios product.

BlockDex