Glow Button
A customizable button component with a glowing border animation effect
The GlowButton
component is a customizable button that features a rotating gradient border effect, creating an elegant glowing animation. It’s built with React Native and Expo, perfect for creating eye-catching interactive elements.
Installation
No additional installation required if you already have the following dependencies:
- react-native-reanimated
- expo-linear-gradient
Import
Usage
Basic Usage
Custom Colors
Custom Styling
Props
Function to call when the button is pressed.
Additional styles for the main container.
The content to render inside the button.
Array of colors for the gradient border effect.
Duration of one complete rotation animation in milliseconds.
Background color of the button’s inner content area.
Additional styles for the inner button container.
Height of the button.
Width of the button.
Border radius of the button.
Margin between the border and inner content.
Whether the button is disabled.
Additional styles for the gradient container.
Features
- Smooth rotating gradient border animation
- Customizable colors and dimensions
- Support for both square and rounded shapes
- Theme-aware styling
- Accessibility support
- Responsive to layout changes
Examples
Circular Glow Button
Full-width Glow Button
Disabled State
Notes
- The glow effect is created using a rotating LinearGradient
- The component automatically calculates the diagonal length for smooth rotation
- Colors array should contain at least 2 colors for the gradient effect
- The component respects the current theme mode (light/dark)
- All measurements can be provided in numbers or string percentages
Was this page helpful?