@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.
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, gradient, glow, or pulse effects
- 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
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. Anyway, 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 four different 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 a glowing light that travels along the border path. The beam moves continuously around the element's perimeter, following the border radius. This is ideal for highlighting interactive elements or creating a futuristic UI feel.
Key props for beam variant:
size- Controls the size of the beam (the glowing spot)anchor- Adjusts how far inward the beam follows the border pathduration- Controls how fast the beam travels around the border
Gradient
The gradient variant creates a rotating conic gradient effect around the border. The gradient smoothly transitions between colorFrom and colorTo while continuously rotating. This creates an elegant, hypnotic effect suitable for loading states or premium UI elements.
Key props for gradient variant:
duration- Controls the rotation speedblur- Adds a soft glow effect to the 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 glowopacity- 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
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.
withMask=true
Clipped to border
withMask=false
Glow extends outward
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
anchor
The anchor prop controls how far inward the beam follows the border path. By default, anchor={0} makes the beam follow the outer edge. Positive values move the beam path inward, which is especially useful when combined with withMask={false} to create inner glow effects that illuminate the content area.
anchor=0
Outer edge
anchor=50
Moved inward
anchor=40
Inner glow effect
Combine anchor with zIndex={-1} and withMask={false} to create beautiful background glow effects. Higher anchor values move the glow closer to the center, creating different illumination patterns behind your content.
anchor=0
Outer background
anchor=30
Closer background
anchor=60
Centered glow
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