Skip to content
Brok UI

Loading…

No results

Glow & border effects

Open source

Animated colored treatments that travel around an element's border, plus cursor-tracked and ambient glow effects.

Version
v1.1.2
Stability
stable
License
MIT
Related
Spotlight
Glow

Border Glow — A rotating colored border animation. `variant="glow"` (default) is a soft, wide glow; `variant="shine"` is a thin, bright shine streak that sweeps crisply around the border.

Preview

Border Glow

A soft rotating glow sweeps around the border.

Variant
previews.components.border-glow.default.blade.php Blade
<x-ui.border-glow>
    <div class="w-64 p-6">
        <h3 class="text-base font-semibold text-foreground">Border Glow</h3>
        <p class="mt-1 text-sm text-muted-foreground">A soft rotating glow sweeps around the border.</p>
    </div>
</x-ui.border-glow>
Glow Current
Shine Current

Installation

terminal
php artisan ui:add border-glow

Registry contract

php artisan ui:add border-glow writes only the files below. The CLI validates each file hash before writing and asks before it replaces a local change, unless you pass --force.

  • blade resources/views/components/ui/border-glow.blade.php
Registry dependencies
None — installs on its own.
Packages
composer: jml/brok:^0.2

Use with AI

A brief for your coding agent: install command, usage, props, guidance and the rules. Copy it, or open a prompt about this component in an assistant.

border-glow.md
# Brok UI: Border Glow (`border-glow`)

A rotating colored border animation. `variant="glow"` (default) is a soft, wide glow; `variant="shine"` is a thin, bright shine streak that sweeps crisply around the border.

Brok UI is a Laravel Blade component registry. Installed components are plain Blade files the app owns.

## Install

```bash
php artisan ui:add border-glow
```

## Usage

```blade
<x-ui.border-glow>
    <div class="w-64 p-6">
        <h3 class="text-base font-semibold text-foreground">Border Glow</h3>
        <p class="mt-1 text-sm text-muted-foreground">A soft rotating glow sweeps around the border.</p>
    </div>
</x-ui.border-glow>
```

## Props

- `variant` (glow|shine, default `glow`) — glow is a soft, wide rotating glow; shine is a thin, bright sweeping streak.
- `color` (mixed|null, default `null`) — Colour token: primary, secondary, foreground, or accent; defaults to primary for glow and foreground for shine.
- `duration` (mixed|null, default `null`) — Seconds for one full rotation; defaults to 6 for glow and 8 for shine.
- `radius` (mixed|null, default `null`) — Corner radius CSS value; defaults to var(--radius-lg).
- `borderWidth` (mixed|null, default `null`) — Border thickness CSS value; defaults to 2px for glow and 1px for shine.

## Use when

- Use only when visual expression supports storytelling, brand differentiation, or a clear showcase moment.
- Wrapping a card, panel, or call-to-action in a rotating colored border to draw attention without changing its background.
- Wanting either a soft wide glow (variant="glow") or a thin, crisp sweeping shine (variant="shine") around the same wrapped content.

## Avoid when

- Do not place heavy effects in task-dense workflows where clarity, speed, and readability matter more.
- Needing a static, non-animated border; use ordinary border utilities on the child instead.
- Highlighting a cursor-following light on a card's surface; use spotlight instead.

## Anti-patterns

- Heavy effects in forms or task-dense workflows
- Motion that interferes with reading or focus

## Rules

- Use the `<brok:border-glow>` tag (or `<x-ui.border-glow>`) in Blade; do not rewrite the component.
- Prefer the documented props and variants over utility-class overrides; when a utility must win, use the `!` important modifier.
- Use semantic design tokens (`bg-primary`, `text-muted-foreground`), never raw colour utilities.
- Keep the `data-slot` attributes; they are the styling and test hooks.

## Links

- Docs: https://brokui.dev/docs/components/border-glow
- Registry JSON (files, props, contract): https://brokui.dev/r/open/border-glow.json

Working in Claude Code, Cursor or Codex? Give the agent the whole registry through the MCP server or the Brok UI skill.

API

manifest knowledge + registry-derived coverage

Props

Props accepted by this component: name, type, default value and description.
Prop Type Default Description
variant glow | shine glow glow is a soft, wide rotating glow; shine is a thin, bright sweeping streak.
color mixed | null null Colour token: primary, secondary, foreground, or accent; defaults to primary for glow and foreground for shine.
duration mixed | null null Seconds for one full rotation; defaults to 6 for glow and 8 for shine.
radius mixed | null null Corner radius CSS value; defaults to var(--radius-lg).
borderWidth mixed | null null Border thickness CSS value; defaults to 2px for glow and 1px for shine.

Slots

  • default — Content wrapped inside the glowing or shining border.

Data slots

Stable hooks for CSS overrides and browser tests.

shine-border {{ $slotName }}

Behavior

  • A rotating conic-gradient layer sits behind an inner bg-card panel, so only the border ring appears to glow or shine.
  • shine-border composes this component with variant="shine" under its own data-slot; the animation is motion-safe only, so reduced-motion users get a static themed border.
  • Declares registry capability flags: a11y, responsive, rtl, darkMode, localized, reducedMotion.

Guidance

Expressive and showcase effect

Support brand expression or a showcase moment.

Use when

  • Use only when visual expression supports storytelling, brand differentiation, or a clear showcase moment.
  • Wrapping a card, panel, or call-to-action in a rotating colored border to draw attention without changing its background.
  • Wanting either a soft wide glow (variant="glow") or a thin, crisp sweeping shine (variant="shine") around the same wrapped content.

Avoid when

  • Do not place heavy effects in task-dense workflows where clarity, speed, and readability matter more.
  • Needing a static, non-animated border; use ordinary border utilities on the child instead.
  • Highlighting a cursor-following light on a card's surface; use spotlight instead.

Use instead

  • Static content-first presentation

Anti-patterns

  • Heavy effects in forms or task-dense workflows
  • Motion that interferes with reading or focus
Anatomy
root shine-border
Theming hooks
shine-border {{ $slotName }}

Accessibility

WCAG 2.2 AA Keyboard focus-visible RTL-ready Localized labels Dark mode
Keyboard
No component-owned keyboard interaction; native element behavior applies.
Focus
none
  • The glow/shine layer is aria-hidden and purely decorative; it never carries content or interactive semantics.
  • Colour comes entirely from semantic tokens (primary, secondary, foreground, accent), so the effect themes correctly in dark mode.
  • Semantic HTML and a stable data-slot attribute for styling and scripting hooks.
  • Focus-visible rings use the ring token, so keyboard focus is always visible.
  • Disabled and invalid states are conveyed to assistive tech, not by color alone.
  • Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces in the preview.
  • Labels go through __() and layout uses logical properties (ms-*, text-start), so it mirrors under dir="rtl" — flip the preview to RTL to confirm.
  • Dark mode uses the same semantic tokens under the dark class; high contrast follows forced-color system tokens.

Livewire

Safe

Livewire can update this component through forwarded wire:* attributes.

Source

The exact, editable file ui:add writes into your app. Previews render this same code; there are no preview-only components.

resources/views/components/ui/border-glow.blade.php Blade
@props([
    // glow (default): a soft, wide rotating colored glow. shine: a thin,
    // bright shine streak that sweeps crisply around the border.
    'variant' => 'glow',
    'color' => null,
    'duration' => null,
    'radius' => null,
    'borderWidth' => null,
])

@php
    $styles = require base_path(config('ui.component_path', 'resources/views/components/ui').'/_styles.php');
    $variant = $styles['normalizeVariant']($variant);

    // A conic-gradient layer spins inside an overflow-hidden rounded box; an
    // inner bg-card panel covers the centre so only a glowing/shining border
    // remains. Animation is motion-safe only, so reduced-motion users get a
    // static (still themed) border. `glow` and `shine` share this outline —
    // they only differ in the conic-gradient arc width and defaults — so
    // `shine` is a variant prop here rather than a separate component
    // (see docs/adr/002-compositions-and-variants.md).
    $variant = in_array($variant, ['glow', 'shine'], true) ? $variant : 'glow';

    $defaults = $variant === 'shine'
        ? ['color' => 'foreground', 'duration' => 8, 'borderWidth' => '1px']
        : ['color' => 'primary', 'duration' => 6, 'borderWidth' => '2px'];

    $color = $color ?? $defaults['color'];
    $duration = $duration ?? $defaults['duration'];
    $borderWidth = $borderWidth ?? $defaults['borderWidth'];

    $glowColor = match ($color) {
        'primary' => 'text-primary',
        'secondary' => 'text-secondary',
        'foreground' => 'text-foreground',
        'accent' => 'text-accent',
        default => 'text-primary',
    };

    $dur = is_numeric($duration) ? $duration.'s' : $duration;
    $r = $radius ?? 'var(--radius-lg)';

    // Fixed, fully-static class strings per branch — a variable spliced into
    // an arbitrary animate-[…] class is invisible to the Tailwind JIT scanner.
    $animateClass = $variant === 'shine'
        ? 'motion-safe:animate-[ui-shine-border-spin_var(--dur)_linear_infinite]'
        : 'motion-safe:animate-[ui-border-glow-spin_var(--dur)_linear_infinite]';
    $gradientClass = $variant === 'shine'
        ? '[background:conic-gradient(from_0deg,transparent_0%,currentColor_6%,transparent_12%,transparent_100%)]'
        : '[background:conic-gradient(from_0deg,transparent_0%,currentColor_25%,transparent_50%,currentColor_75%,transparent_100%)]';
    $wrapperClass = 'relative inline-block overflow-hidden rounded-[var(--r)]'.($variant === 'shine' ? ' bg-border' : '').' p-[var(--bw)]';

    // shine-border composes this as <x-ui.border-glow variant="shine"
    // data-slot="shine-border">; the browser keeps only the first of two
    // identical attributes, so read the override and print exactly one.
    $slotName = (string) ($attributes->get('data-slot') ?: 'border-glow');
@endphp

<div
    data-slot="{{ $slotName }}"
    data-variant="{{ $variant }}"
    style="--dur:{{ $dur }}; --bw:{{ $borderWidth }}; --r:{{ $r }};"
    {{ $attributes->except('data-slot')->merge(['class' => $wrapperClass]) }}
>
    <div
        aria-hidden="true"
        class="absolute inset-[-100%] {{ $glowColor }} {{ $animateClass }} {{ $gradientClass }}"
    ></div>
    <div class="relative rounded-[calc(var(--r)-var(--bw))] bg-card">{{ $slot }}</div>
</div>

Ownership & lifecycle

Owner, release state, review evidence and adoption for this item.
Owner
Platform UI (@JoshJML)
Current version
1.1.2
Status
Stable
License
open
Accessibility reviewed
No review date recorded
Last breaking change
No date recorded
Deprecation
Not deprecated
Contract
v6
Foundation
≥ 1.0.0