Borders
Add borders and optional animated border rings to elements.
Syntax
Combine .border or an edge utility with a color and optional width. Add .rounded-* independently to control corners.
<div class="border border-primary border-2 rounded p-3">Project summary</div>Class and token reference
| Class or pattern | Effect |
|---|---|
.border, .border-{direction} | Adds all edges or one edge; directions are t, b, s and e. |
.border-{0..5} | Sets border width from 0px through 5px on this element. |
.border-{direction}-0 | Removes the selected edge. |
.border-{color}, .border-transparent | Sets the border color token. |
.rounded-sm, .rounded, .rounded-lg | Applies the small, regular or large radius token. |
.rounded-top, .rounded-bottom, .rounded-start, .rounded-end | Rounds only the selected edge. |
.rounded-pill, .rounded-circle, .rounded-0 | Applies pill, circular or square corners. |
.border-ring, .border-ring-animated, .border-ring-glow | Adds a decorative static ring, rotation or glow. |
Base borders use --border-width and --border-color. Radius utilities use --border-radius-sm, --border-radius and --border-radius-lg; override these tokens globally or on the element being customized.
Default
Add borders to elements.
<div class="border border-primary">border border-primary</div>
<div class="border border-secondary">border border-secondary</div>
<div class="border border-warning">border border-warning</div>
<div class="border border-success">border border-success</div>
<div class="border border-error">border border-error</div>Border rings
Add .border-ring for a static partial ring. Add .border-ring-animated to rotate its colored section, and .border-ring-glow for an optional blurred glow. The ring and glow remain visible without rotation when reduced motion is requested. The effect does not change layout or block pointer events. It can sit over a normal border. Apply a border radius to the element for rounded or circular rings.
<button class="btn border-ring border-ring-primary">Static ring</button>
<button class="btn border-ring border-ring-animated border-ring-error rounded-pill">
Animated ring
</button>
<div
class="border-ring border-ring-animated border-ring-glow rounded bg-inverse d-flex align-items-center p-4 w-100 w-md-50 w-lg-25"
style="--border-ring-stops: transparent 0deg, var(--primary) 70deg, var(--accent) 110deg, transparent 150deg, transparent 360deg; --border-ring-width: 3px; --border-ring-offset: 2px; --border-ring-duration: 3s;">
<strong>Customized card ring</strong>
</div>Theme color variants
Use the semantic color modifiers to keep a ring aligned with the active theme.
border-ring-primary
border-ring-secondary
border-ring-accent
border-ring-success
border-ring-warning
border-ring-error
<div class="border-ring border-ring-primary rounded p-3">Primary</div>
<div class="border-ring border-ring-secondary rounded p-3">Secondary</div>
<div class="border-ring border-ring-accent rounded p-3">Accent</div>
<div class="border-ring border-ring-success rounded p-3">Success</div>
<div class="border-ring border-ring-warning rounded p-3">Warning</div>
<div class="border-ring border-ring-error rounded p-3">Error</div>Shapes, offsets and glows
The ring follows the element’s border radius, so it can frame cards, circles and pill-shaped
controls. Increase --border-ring-offset when the ring should sit outside the element, and tune
the width and glow independently for each example.
<div
class="border-ring border-ring-animated border-ring-accent border-ring-glow rounded-circle bg-inverse d-flex flex-column align-items-center justify-content-center text-center"
style="inline-size: 6rem; block-size: 6rem; --border-ring-width: 4px; --border-ring-offset: 3px; --border-ring-glow-blur: 9px;">
<strong>72%</strong>
<span>complete</span>
</div>
<div
class="border-ring border-ring-animated border-ring-success rounded-lg bg-surface p-4"
style="--border-ring-width: 4px; --border-ring-size: 140deg; --border-ring-offset: 3px;">
<strong>Live status</strong>
<span>Updated just now</span>
</div>
<button
class="btn border-ring border-ring-warning border-ring-glow rounded-pill"
style="--border-ring-width: 3px; --border-ring-offset: 2px;">
Needs attention
</button>Color modifiers: .border-ring-primary, .border-ring-secondary, .border-ring-accent, .border-ring-success, .border-ring-warning, and .border-ring-error. They set only --border-ring-color and follow theme overrides.
| Custom property | Default | Purpose |
|---|---|---|
--border-ring-color | currentColor | Colored section |
--border-ring-width | 2px | Ring thickness |
--border-ring-size | 90deg | Colored arc size |
--border-ring-offset | 0px | Distance outside the element |
--border-ring-duration | 2.5s | Rotation time |
--border-ring-stops | single colored arc | Optional conic-gradient color stops |
--border-ring-glow-blur | 6px | Glow blur radius |
--border-ring-glow-opacity | 0.8 | Glow opacity |
The glow uses ::after; leave this pseudo-element available on the target element. Ancestors with clipped overflow can hide the glow.
Border widths
Apply border widths by using border-* (0 to 5). The width only applies to the selected element, so nested component borders remain unchanged.
<div class="border border-0 border-primary">border border-0 border-primary</div>
<div class="border border-1 border-primary">border border-1 border-primary</div>
<div class="border border-2 border-primary">border border-2 border-primary</div>
<div class="border border-3 border-primary">border border-3 border-primary</div>
<div class="border border-4 border-primary">border border-4 border-primary</div>
<div class="border border-5 border-primary">border border-5 border-primary</div>Border directions
Add borders to specific directions of elements.
<div class="border-t border-primary">border-t border-primary</div>
<div class="border-s border-primary">border-s border-primary</div>
<div class="border-e border-primary">border-e border-primary</div>
<div class="border-b border-primary">border-b border-primary</div>Remove border for specific direction
Remove borders to specific directions of elements.
<div class="border border-primary border-t-0">border border-primary border-t-0</div>Rounded borders for directions
Add classes to an element to round its corners.
<div class="p-2 border border-primary rounded">border border-primary rounded</div>
<div class="p-2 border border-primary rounded-top">border border-primary rounded-top</div>
<div class="p-2 border border-primary rounded-bottom">border border-primary rounded-bottom</div>
<div class="p-2 border border-primary rounded-start">border border-primary rounded-start</div>
<div class="p-2 border border-primary rounded-end">border border-primary rounded-end</div>Border radius
Use different border radius values.
<div class="p-2 border border-primary rounded-sm">border border-primary rounded-sm</div>
<div class="p-2 border border-primary rounded">border border-primary rounded-top</div>
<div class="p-2 border border-primary rounded-lg">border border-primary rounded-lg</div>
<div class="p-2 border border-primary rounded-pill">border border-primary rounded-pill</div>Responsive behavior
Border, radius and ring utilities have no breakpoint variants. Combine them with responsive Sizing and Spacings utilities. Logical start/end edges follow the document direction. Animated rings respect reduced motion; keep meaningful state text visible independently of the effect.
Recipes
Separate a summary from its actions
Combine a border edge with spacing; no extra wrapper styles are needed.
Project summary
View card patterns<div class="border rounded bg-surface p-3">
<p class="border-b pb-3 mb-3">Project summary</p>
<a href="/components/card">View card patterns</a>
</div>Highlight a featured panel
Keep the recommendation in text as well as the ring. The static effect needs no animation.
<div class="border-ring border-ring-accent rounded p-3">Recommended plan</div>