Skip to content

Typing Spinner

The TypingSpinner component displays a loading animation that resembles a typing indicator, perfect for chat or messaging interfaces.

Basic Usage

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

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

Live Demo:

Props

Prop NameTypeDefaultDescription
sizenumber40Size in pixels
colorstring#2196F3Color of the dots
speednumber1Animation speed in seconds
dotCountnumber3Number of dots
classNamestring""Additional CSS class names
styleobject{}Additional inline styles

Examples

Basic Typing Spinner

jsx
<TypingSpinner size={48} color="#2196F3" speed={1} dotCount={3} />

Custom Size and Color

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

Custom Dot Count

jsx
<TypingSpinner dotCount={4} color="#ff3366" />

With Custom Styling

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

Implementation Details

The TypingSpinner consists of multiple dots that animate in sequence to create a typing effect. Each dot is sized relative to the container and animates with a calculated delay.

jsx
// Internal structure
<div className="typing-spinner">
  {[...Array(dotCount)].map((_, i) => (
    <div
      className="typing-dot"
      style={{
        animationDelay: `${(i * speed) / 3}s`,
      }}
    />
  ))}
</div>

Common Use Cases

Highlight typical scenarios where the spinner might be used:

  • Chat applications
  • Message typing indicators
  • Response waiting states
  • User status indicators
  • Interactive feedback

Troubleshooting

Address potential issues developers might encounter, like:

  • Dot sizing and spacing
  • Animation timing
  • 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.