An open API service indexing awesome lists of open source software.

https://github.com/oda2/react-text-typing

Component that performs the effect of writing
https://github.com/oda2/react-text-typing

effects hacktoberfest library react text

Last synced: 4 months ago
JSON representation

Component that performs the effect of writing

Awesome Lists containing this project

README

          


react-text-typing

react-text-typing


A lightweight React component that creates a realistic typewriter animation effect with cursor blinking.



npm version


CI


Coverage


Bundle Size


License

---

## โœจ Features

- ๐ŸŽฏ **Lightweight** - Zero dependencies, tiny bundle (~11kb gzipped)
- โšก **Performant** - Built with React hooks, optimized for speed
- ๐ŸŽจ **Customizable** - Colors, speed, font size, cursor blink
- โ™ฟ **Accessible** - Semantic HTML, works with screen readers
- ๐Ÿ“ฆ **Tree-shakeable** - Import only what you need
- ๐Ÿ”ง **TypeScript** - Full TypeScript support included
- ๐Ÿงช **Well tested** - 100% test coverage

## ๐Ÿ“ฆ Installation

```bash
npm install react-text-typing
```

or

```bash
yarn add react-text-typing
```

## ๐Ÿš€ Quick Start

```tsx
import TextTyping from 'react-text-typing';
import 'react-text-typing/css';

function App() {
return ;
}
```

## ๐Ÿ’ป Usage

### Basic

```tsx

```

### Custom Speed

```tsx

```

### Custom Colors

```tsx

```

### Disable Cursor Blink

```tsx

```

### Custom Font Size

```tsx

```

### With Callback

```tsx
console.log('Done!')} />
```

### Custom Component

```tsx

```

## ๐Ÿ“š API Reference

| Prop | Type | Default | Description |
| ------------- | --------------------- | --------- | -------------------------------------- |
| `text` | `string` | Required | Text to type out |
| `speed` | `number` | `500` | Milliseconds between each character |
| `colorText` | `string` | `#fff` | Color of the typed text |
| `colorTyping` | `string` | `#0075D7` | Color of the typing effect |
| `showBlink` | `boolean` | `true` | Show/hide cursor blink |
| `fontSize` | `string` | `5em` | Font size of the text |
| `timeTyping` | `number` | `10` | Duration of typing animation (seconds) |
| `component` | `string \| Component` | `"span"` | HTML element or custom component |
| `onComplete` | `() => void` | - | Callback when typing finishes |
| `className` | `string` | - | Additional CSS class |

## ๐ŸŽจ Styling

The component includes default CSS. To customize, you can:

1. **Override CSS variables:**

```tsx

```

2. **Add your own styles:**

```css
.text-typing {
font-family: 'Fira Code', monospace;
}
```

3. **Import only CSS and customize:**

```js
import 'react-text-typing/css';
```

## ๐Ÿ› ๏ธ Development

```bash
# Install dependencies
npm install

# Run tests
npm test

# Run tests with coverage
npm run coverage

# Run Storybook
npm run dev

# Build library
npm run build:lib

# Lint
npm run lint
```

## ๐Ÿค Contributing

Contributions are welcome! Please read our [contributing guidelines](CONTRIBUTING.md) first.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

## ๐Ÿ“– Storybook

We use Storybook for component development and documentation. Run `npm run dev` to explore the component in an interactive environment.

## ๐Ÿ› Issues

Found a bug? Please [open an issue](https://github.com/Oda2/react-text-typing/issues) with a detailed description.

## ๐Ÿ“ License

MIT License - see the [LICENSE](LICENSE) file for details.

---


Made with โค๏ธ by Renato Oda