Skip to content
MarkasUI
Type to search

    Guide

    MarkasUI

    Form

    Feedback

    Overlay

    Navigation

    Data

    Sections

    Animations

    Backgrounds

    Buttons

    Templates

    Pages

    Gradient Border

    Wraps a card, button, or field in a moving gradient border that spins, shines, or pulses, with an optional soft glow.

    Pro workspace

    Unlimited projects, priority support, and advanced analytics.

    $24 / month

    Pro workspace

    Unlimited projects, priority support, and advanced analytics.

    $24 / month

    Pro workspace

    Unlimited projects, priority support, and advanced analytics.

    $24 / month

    Pro workspace

    Unlimited projects, priority support, and advanced analytics.

    $24/ month

    Pro workspace

    Unlimited projects, priority support, and advanced analytics.

    $24 / month

    <x-markas.gradient-border class="mx-auto max-w-80">
      <div class="grid gap-3 p-6">
        <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
        <p class="text-sm text-muted">
          Unlimited projects, priority support, and advanced analytics.
        </p>
        <p class="text-3xl font-bold text-ink">
          $24<span class="text-sm font-normal text-muted"> / month</span>
        </p>
        <x-markas.button>Upgrade now</x-markas.button>
      </div>
    </x-markas.gradient-border>
    import { Button } from "@/components/markas/Button";
    import { GradientBorder } from "@/components/markas/GradientBorder";
    
    export default function GradientBorderExample() {
      return (
        <GradientBorder className="mx-auto max-w-80">
          <div className="grid gap-3 p-6">
            <h3 className="text-lg font-semibold text-ink">Pro workspace</h3>
            <p className="text-sm text-muted">
              Unlimited projects, priority support, and advanced analytics.
            </p>
            <p className="text-3xl font-bold text-ink">
              $24<span className="text-sm font-normal text-muted"> / month</span>
            </p>
            <Button>Upgrade now</Button>
          </div>
        </GradientBorder>
      );
    }
    <script setup lang="ts">
    import Button from "@/components/markas/Button.vue";
    import GradientBorder from "@/components/markas/GradientBorder.vue";
    </script>
    
    <template>
      <GradientBorder class="mx-auto max-w-80">
        <div class="grid gap-3 p-6">
          <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
          <p class="text-sm text-muted">
            Unlimited projects, priority support, and advanced analytics.
          </p>
          <p class="text-3xl font-bold text-ink">
            $24<span class="text-sm font-normal text-muted"> / month</span>
          </p>
          <Button>Upgrade now</Button>
        </div>
      </GradientBorder>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import GradientBorder from "$lib/components/markas/GradientBorder.svelte";
    </script>
    
    <GradientBorder class="mx-auto max-w-80">
      <div class="grid gap-3 p-6">
        <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
        <p class="text-sm text-muted">
          Unlimited projects, priority support, and advanced analytics.
        </p>
        <p class="text-3xl font-bold text-ink">
          $24<span class="text-sm font-normal text-muted"> / month</span>
        </p>
        <Button>Upgrade now</Button>
      </div>
    </GradientBorder>
    ---
    import Button from "@/components/markas/Button.astro";
    import GradientBorder from "@/components/markas/GradientBorder.astro";
    ---
    
    <GradientBorder class="mx-auto max-w-80">
      <div class="grid gap-3 p-6">
        <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
        <p class="text-sm text-muted">
          Unlimited projects, priority support, and advanced analytics.
        </p>
        <p class="text-3xl font-bold text-ink">
          $24<span class="text-sm font-normal text-muted"> / month</span>
        </p>
        <Button>Upgrade now</Button>
      </div>
    </GradientBorder>
    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import { GradientBorder } from "./markas/gradient-border.component";
    
    @Component({
      selector: "markas-example",
      imports: [Button, GradientBorder],
      template: `
        <div markas-gradient-border class="mx-auto max-w-80">
          <div class="grid gap-3 p-6">
            <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
            <p class="text-sm text-muted">
              Unlimited projects, priority support, and advanced analytics.
            </p>
            <p class="text-3xl font-bold text-ink">
              $24<span class="text-sm font-normal text-muted"> / month</span>
            </p>
            <button markas-button>Upgrade now</button>
          </div>
        </div>
      `,
    })
    export default class GradientBorderFixture {}

    Examples

    Shining buttons

    Featured plan with glow

    Starter

    $0

    For side projects.

    Team

    $49

    Most popular.

    Starter

    $0

    For side projects.

    Team

    $49

    Most popular.

    Starter

    $0

    For side projects.

    Team

    $49

    Most popular.

    Starter

    $0

    For side projects.

    Team

    $49

    Most popular.

    Starter

    $0

    For side projects.

    Team

    $49

    Most popular.

    AI prompt field

    Installation

    npx markasui@latest add gradient-border

    Usage

    <x-markas.gradient-border variant="spin" :glow="true" class="max-w-80">
        <div class="grid gap-3 p-6">
            <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
            <x-markas.button>Upgrade now</x-markas.button>
        </div>
    </x-markas.gradient-border>

    No JavaScript or Alpine.js needed.

    import { GradientBorder } from "@/components/markas/GradientBorder";
    
    <GradientBorder variant="spin" glow className="max-w-80">
      <div className="grid gap-3 p-6">
        <h3 className="text-lg font-semibold text-ink">Pro workspace</h3>
        <Button>Upgrade now</Button>
      </div>
    </GradientBorder>;
    <template>
      <GradientBorder variant="spin" glow class="max-w-80">
        <div class="grid gap-3 p-6">
          <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
          <Button>Upgrade now</Button>
        </div>
      </GradientBorder>
    </template>
    <script lang="ts">
      import Button from "$lib/components/markas/Button.svelte";
      import GradientBorder from "$lib/components/markas/GradientBorder.svelte";
    </script>
    
    <GradientBorder variant="spin" glow class="max-w-80">
      <div class="grid gap-3 p-6">
        <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
        <Button>Upgrade now</Button>
      </div>
    </GradientBorder>
    ---
    import Button from "@/components/markas/Button.astro";
    import GradientBorder from "@/components/markas/GradientBorder.astro";
    ---
    
    <GradientBorder variant="spin" glow class="max-w-80">
      <div class="grid gap-3 p-6">
        <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
        <Button>Upgrade now</Button>
      </div>
    </GradientBorder>

    No client-side JavaScript; the markup is rendered on the server.

    import { Component } from "@angular/core";
    import { Button } from "./markas/button.component";
    import { GradientBorder } from "./markas/gradient-border.component";
    
    @Component({
      selector: "app-hero",
      imports: [Button, GradientBorder],
      template: `
        <div markas-gradient-border variant="spin" glow class="max-w-80">
          <div class="grid gap-3 p-6">
            <h3 class="text-lg font-semibold text-ink">Pro workspace</h3>
            <button markas-button>Upgrade now</button>
          </div>
        </div>
      `,
    })
    export class Hero {}

    The component is an attribute on a div, so class, style, and other attributes stay on the root element.

    • The border is 1px. Put padding on the content inside; the inner panel uses bg-surface.
    • For a pill button use radius="full" with inline-block on the component and rounded-full on the button.
    • spin uses container query units, supported by every current browser.
    • The component has no built-in text, so there are no label props to translate.

    Props

    NameTypeDefaultDescription
    variantspin | shine | pulsespinspin rotates a conic gradient around the edge, shine sweeps a glint across, pulse breathes the whole border.
    colormuted | primary | success | warning | dangerprimaryToken color of the gradient.
    speedslow | normal | fastnormalLength of one cycle: 8s, 4s, or 2s.
    radiuslg | xl | fullxlCorner radius of the border and the inner surface.
    glowbooleanfalseAdds a soft blurred copy of the gradient behind the border.
    children / slotslot / ReactNode / snippet-Content inside the border, on a bg-surface panel.

    Accessibility

    • The gradient layers are aria-hidden and ignore pointer events.
    • With reduced motion, the gradient stays still in a fixed position.
    • Focus styles of the content inside are not covered by the border.

    Related components

    More backgrounds components with the same classes in every framework.