Skip to content

Heartbeat Spinner

The HeartbeatSpinner component displays a loading animation with a pulsing heart effect, perfect for creating engaging and playful loading states.

Basic Usage

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

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

Live Demo:

Props

Prop NameTypeDefaultDescription
sizenumber40Size in pixels
colorstring#FF4B4BColor of the heart
speednumber1Animation speed in seconds
classNamestring""Additional CSS class names
styleobject{}Additional inline styles

Examples

Basic Heartbeat Spinner

jsx
<HeartbeatSpinner size={48} color="#FF4B4B" speed={1} />

Custom Size and Color

jsx
<HeartbeatSpinner size={60} color="#ff3366" />

Custom Animation Speed

jsx
<HeartbeatSpinner speed={1.2} color="#ff6699" />

With Custom Styling

jsx
<HeartbeatSpinner
  size={50}
  color="#ff4d4d"
  className="custom-heartbeat"
  style={{ margin: "20px" }}
/>

Implementation Details

The HeartbeatSpinner consists of a heart shape that pulses using CSS animations. The heart is created using border properties and transforms.

jsx
// Internal structure
<div className="heartbeat-spinner">
  <div
    className="heart"
    style={{
      borderColor: color,
      backgroundColor: color,
    }}
  />
</div>

Common Use Cases

Highlight typical scenarios where the spinner might be used:

  • Social media applications
  • Dating applications
  • Like/favorite animations
  • Emotional feedback states
  • Engagement indicators

Troubleshooting

Address potential issues developers might encounter, like:

  • Heart shape rendering
  • Animation smoothness
  • Browser compatibility
  • Performance optimization
  • Mobile responsiveness

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

Released under the MIT License.