Animated Border Button
A customizable animated border button component with loading state support
AnimatedBorderButton
The AnimatedBorderButton
component is a highly customizable button that features an animated border effect. It supports loading states and can be styled to match your application’s theme.
Installation
No additional installation required if you already have the following dependencies:
- react-native-reanimated
- expo-linear-gradient
Import
Usage
Basic Usage
With Loading State
Custom Styling
Props
The width of the button. Can be a number or percentage string.
The height of the button in pixels.
The border radius of the button.
The width of the animated slider element.
The height of the animated slider element.
The duration of one complete animation cycle in milliseconds.
The color of the button’s path/track.
The color of the animated slider.
The background color of the button’s inner container.
Whether the button is disabled.
Whether to show the loading state.
Function to call when the button is pressed.
The content to render inside the button.
Features
- Smooth border animation effect
- Loading state support
- Customizable colors and dimensions
- Support for circular and rectangular shapes
- Responsive to layout changes
- Theme-aware styling
Examples
Circular Button
Full-width Button
Disabled State
Notes
- The button automatically adjusts its animation pattern when width equals height and borderRadius is at least half of width (circular button)
- The loading state will display a spinner and disable the button
- The component uses
react-native-reanimated
for smooth animations - Inner container color defaults to theme primary color if not specified
Was this page helpful?