Skip to content

Ripple Spinner

The RippleSpinner component displays a loading animation with expanding ripple effects radiating from a central point, creating a smooth and engaging loading indicator.

Basic Usage

jsx
import { RippleSpinner } from "fancy-react-ui";

function App() {
  return <RippleSpinner />;
}

Live Demo:

Props

Prop NameTypeDefaultDescription
sizenumber40Size in pixels
colorstring#0066ffColor of ripples
speednumber1Animation speed in seconds
thicknessnumber2Thickness of ripples
rippleCountnumber3Number of ripple rings
classNamestring""Additional CSS class names
styleobject{}Additional inline styles

Examples

Basic Ripple Spinner

jsx
<RippleSpinner
  size={48}
  color="#2196F3"
  speed={1}
  thickness={2}
  rippleCount={3}
/>

Custom Size and Color

jsx
<RippleSpinner size={60} color="#9933ff" />

Custom Ripple Configuration

jsx
<RippleSpinner rippleCount={4} thickness={3} color="#ff3366" />

With Custom Styling

jsx
<RippleSpinner
  size={50}
  color="#33cc33"
  className="custom-ripple"
  style={{ margin: "20px" }}
/>

Implementation Details

The RippleSpinner consists of multiple expanding rings and a central dot. Each ring animates with a calculated delay to create a ripple effect.

jsx
// Internal structure
<div className="ripple-spinner">
  {[...Array(rippleCount)].map((_, i) => (
    <div
      className="ripple"
      style={{
        borderWidth: thickness,
        borderColor: color,
        animationDelay: `${(i * speed) / rippleCount}s`,
      }}
    />
  ))}
  <div
    className="ripple-center"
    style={{
      backgroundColor: color,
      width: size * 0.2,
      height: size * 0.2,
    }}
  />
</div>

Common Use Cases

Highlight typical scenarios where the spinner might be used:

  • Click feedback
  • Location indicators
  • Network activity
  • Data synchronization
  • Interactive feedback

Troubleshooting

Address potential issues developers might encounter, like:

  • Ring scaling
  • Animation timing
  • Center point alignment
  • Browser compatibility
  • Performance optimization

Explore similar components within the same library or ecosystem to find the best fit for your use case:

Released under the MIT License.