@gfazioli/mantine-border-animate
Mantine component offering four border animation variants (beam, glow, gradient, pulse) with customizable colors and full animation control, perfect for creating dynamic, visually engaging UI elements.
Upgrading from 0.x to 1.0
Version 1.0 is a major rewrite of the beam variant. The beam now supports two rendering modes (path and conic) and several props have been removed, renamed, or changed semantics.
Breaking Changes
Removed props
| Prop | Replacement |
|---|---|
opacity | Renamed to |
anchor | Removed — no longer needed with the new beam implementation |
count | Removed — use |
Removed variant
| Variant | Replacement |
|---|---|
gradient | Use |
Changed props
| Prop | v0.x | v1.0 |
|---|---|---|
| Pixel size of the traveling circle (64px–480px) | Depends on |
New props
| Prop | Description |
|---|---|
beamMode |
|
colorStops | Array of |
borderOpacity | Opacity of the border effect (0–1), replaces
|
timingFunction | CSS animation timing function override |
pauseOnHover | Pause animation on hover |
Migration examples
Rename opacity to borderOpacity:
Replace variant="gradient" with conic beam + colorStops:
Remove anchor and count props:
Installation
After installation import package styles at the root of your application:
You can import styles within a layer @layer mantine-border-animate by importing @gfazioli/mantine-border-animate/styles.layer.css file.
Usage
The BorderAnimate component wraps any element to add stunning animated border effects. It's perfect for creating eye-catching UI elements like cards, buttons, input fields, alerts, and more.
Key Features
- Multiple animation variants - Choose from beam, glow, or pulse effects
- Two beam modes -
path(uniform size along the border) orconic(rotating gradient wedge) - Fully customizable - Control colors, duration, size, blur, and more
- Works with any element - Wrap buttons, cards, inputs, or any Mantine component
- Performance optimized - Uses CSS animations for smooth 60fps effects
- Controllable - Toggle animation on/off, show/hide the border, set static angles
- Custom color stops - Multi-color gradients with
colorStopsfor both beam modes - Pause on hover - Pause animations when hovering with
pauseOnHover - Accessible - Respects
prefers-reduced-motionautomatically
Simply wrap your content with BorderAnimate and customize it using props:
Animate Border
This is an example of BorderAnimate component
Controlled
You can control the border animation using the show prop.
This is a title
This is a paragraph inside the BorderAnimate component.
Animated
You can also control the border animation using the animate prop. If animate is set to true, the border will animate continuously. If animate is set to false, the border will be static. You can control the angle of the border animation using the angle prop.
This is a title
This is a paragraph inside the BorderAnimate component.
Variant
The BorderAnimate component supports three animation variants, each creating a unique visual effect. Use the variant prop to switch between them.
This is a title
This is a paragraph inside the BorderAnimate component.
Beam
The beam variant (default) creates an animated glow that moves around the border. It supports two rendering modes via the beamMode prop:
path(default) — a radial-gradient circle that travels along the border perimeter via CSSoffset-path. The beam has uniform size at all positions and constant speed along the perimeter.conic— a rotating conic-gradient wedge. The rotation is smooth and continuous, but the beam width varies slightly on rectangular containers (wider at corners, narrower at edges) due to the conic geometry.
Key props for beam variant:
beamMode- Rendering mode:'path'(default) or'conic'size- For path: pixel size of the traveling circle (xs..xl). For conic: angular spread of the wedge (xs=18°..xl=180° or number 0-50)duration- Controls how fast the beam moves/rotatescolorFrom/colorTo- Colors of the beamcolorStops- Full control over the gradient (overrides colorFrom/colorTo). For path mode creates a radial-gradient with concentric color rings, for conic mode creates a custom conic-gradient
Glow
The glow variant produces a pulsating glow effect that fades in and out. The entire border area illuminates with a soft, diffused light that pulses rhythmically. This is perfect for attention-grabbing elements or notification indicators.
Key props for glow variant:
duration- Controls the pulse speedblur- Adjusts the softness of the glowborderOpacity- Controls the maximum opacity of the glow
Pulse
The pulse variant creates a subtle scaling animation combined with opacity changes. The border gently expands and fades, creating a breathing effect. This variant is excellent for subtle emphasis without being too distracting.
Key props for pulse variant:
duration- Controls the pulse rhythmblur- Softens the border effect
Color Stops
The colorStops prop gives you full control over the beam gradient. Each stop has a color (any Mantine color) and a position (0-100%). When provided, it overrides colorFrom/colorTo.
For path mode, colorStops creates a radial-gradient with concentric color rings in the traveling circle. For conic mode, it creates a custom conic-gradient — use transparent stops for beam/wedge effects, or fill the entire circle for a rotating gradient border.
Conic beam
Conic with colorStops
Rainbow
Conic full gradient
Path beam
Path with colorStops
Animation Control
Pause on Hover
Set pauseOnHover to pause the animation when the user hovers over the component. This is useful for interactive elements where the animation might be distracting during interaction.
Hover me!
Beam pauses on hover
Hover me!
Gradient pauses on hover
Timing Function
The timingFunction prop controls the CSS animation timing function. By default, beam uses linear (constant speed), while glow and pulse use ease-in-out (smooth acceleration). You can override this with any valid CSS timing function.
linear
Constant speed
ease-in-out
Smooth acceleration
steps(8)
Stepped / retro
Mask and Background Effects
The withMask and zIndex props allow you to create advanced visual effects, including background glows and layered animations.
withMask
By default, withMask is true, which clips the animated effect to the border area only. Set withMask={false} to let the glow extend beyond the border, creating a softer, more diffused effect. Both beam modes (path and conic) support masking.
Path + mask
Clipped to border
Path no mask
Glow extends outward
Conic + mask
Conic clipped
Conic no mask
Conic full gradient
zIndex
The zIndex prop controls the stacking order of the border effect. By default, the border appears in front of the content (zIndex={1}). Set zIndex={-1} combined with withMask={false} to create beautiful background glow effects that appear behind your content.
zIndex=1
Border in front
zIndex=-1
Background glow
Layered
Front + background
Use Cases
BorderAnimate can be used with virtually any Mantine component. Here are some common use cases to inspire your implementations.
Buttons
Add animated borders to buttons to make them stand out. Perfect for call-to-action buttons, submit buttons, or any interactive element that needs extra attention.
Input Fields
Highlight input fields with animated borders to guide users through forms or indicate active/focused states.
Alerts and Notifications
Make alerts more noticeable with animated borders. Use different variants and colors to convey urgency levels.
Cards
Create premium-looking cards with animated borders. Great for featured content, pricing cards, or special offers.

Premium Package
Get access to all premium features with our special animated border effect that highlights this exclusive offer.
Chips and Badges
Even small elements like chips can benefit from animated borders to indicate selection or special status.
Accordion
Wrap accordion components with animated borders to create visually engaging expandable sections. The border effect adds a modern touch to FAQ sections or collapsible content areas.
Multiple Borders
Nest multiple BorderAnimate components to create complex, layered effects. Combine different variants, speeds, directions, and colors to achieve unique visual compositions. This technique is perfect for hero sections or premium UI elements that need extra visual impact.
Multiple Animated Borders
Circular Elements
BorderAnimate works perfectly with circular shapes. Set radius="100%" to create animated borders around avatars, profile pictures, or any circular UI element. The beam smoothly follows the circular path.
Circle
Simple circle
Avatar
Gradient
Gradient variant
Accessibility
BorderAnimate automatically respects the prefers-reduced-motion media query. When a user has enabled "Reduce motion" in their operating system settings, all animations are disabled. No additional configuration is needed.