Glin UI
Primitive / AtomAdapted from Motion Primitivesbeta

Border Trail

Glowing comet that travels along the border of a rounded container.

Edit on GitHub

Secure by default

A comet runs along the edge.

Installation

Install from
pnpm dlx @glinui/cli@latest add border-trail

Credits. Adapted from Motion Primitives (MIT, (c) 2024 ibelick). motion/react removed (CSS and Web Animations API), tokens, accessibility, reduced motion levels, RTL Attribution details.

Prefer the package?

Usage

The parent must be `relative` with a border radius, and should clip overflow. Distinct from BorderBeam (a dot) and ShineBorder (a drifting gradient): a short comet on a thin track.

Improvement over the original: no hardcoded zinc, offscreen and hidden tab pause, static corner glow at motion none, hidden under forced-colors.

Variants

Color sources per style.

default

A comet runs along the edge.

plain

A comet runs along the edge.

glass

A comet runs along the edge.

<BorderTrail variant="glass" borderWidth={2} />

States

Custom color, length, radius and speed.

Long green trail

A comet runs along the edge.

Fast and thick

A comet runs along the edge.

<BorderTrail color="var(--color-signal-ok)" size={120} />
<BorderTrail radius={32} duration={3} borderWidth={3} size={50} />

In a layout

The highlighted plan wears the trail.

Starter

For side projects.

Team

The highlighted plan wears the trail.

<Card className="relative overflow-hidden">
<BorderTrail borderWidth={2} size={100} />
<PlanContent />
</Card>

Accessibility

  • Purely decorative: aria-hidden, pointer-events-none, never focusable.
  • Hidden under forced-colors so the real border shows.
  • Pauses offscreen and while the tab is hidden.

ARIA Attributes

  • `aria-hidden="true"` on the layer
  • `data-mode` reports `path` or `conic`, `data-animated` reports motion

Reduced Motion

The comet only travels at motion level full. Under motion none, subtle or prefers-reduced-motion it rests as a static glow at the top start corner.

Affected properties

offset-distance travelconic rotation

API Reference

PropTypeRequiredDefaultDescription
variant"default" | "plain" | "glass"NodefaultColor source: accent, foreground or a bright additive accent.
sizenumberNo60Length of the glowing segment in pixels.
durationnumberNo5Seconds per lap.
radiusnumberNo-Path corner radius in pixels. Defaults to the parent border radius.
borderWidthnumberNo1Track thickness in pixels.
colorstringNo-Any CSS color or token for the comet.

Source

Import directly from the package or browse the source on GitHub. Click any file to view it.

Import

import { BorderTrail } from "@glinui/ui"

Dependencies

@glinui/ui@glinui/motionclass-variance-authority

Generated API Snapshot

Beta

Auto-extracted from TypeScript source in packages/ui/src/components/border-trail.tsx. This section is in beta and may lag behind hand-curated docs. Regenerate with pnpm --filter @glinui/docs api:generate.

Generated: 2026-10-08T01:41:21.546Z · Full index: /docs/api-metadata

Primary Props Type

BorderTrailProps

BorderTrailProps

PropTypeRequiredDefaultDescription
borderWidthnumberNo1Border thickness in pixels.
colorstringNo-Trail color. Defaults to the variant token.
durationnumberNo5Seconds per lap.
radiusnumberNo-Corner radius of the path in pixels. Defaults to the parent border radius.
sizenumberNo60Length of the glowing segment in pixels.
variant"default" | "plain" | "glass"No"default"Variant option from borderTrailVariants.