React Component Export

Export your ASCII animations as self-contained React components that can be imported directly into React applications.

Overview

Info

React export generates a complete, dependency-free component that renders your animation on a canvas element.

The exported component:

  • Plays animation automatically
  • Loops by default
  • Includes optional playback controls
  • Works with React 18+
  • Supports TypeScript or JavaScript

Accessing React Export

Click Export in the toolbar

Select React Component from the format dropdown

Configure settings

Click Export to download

React Settings

TypeScript Toggle

OptionOutput
Enabled.tsx file with type definitions
Disabled.jsx file without types

Include Controls

When enabled, the component includes:

  • Play/Pause button
  • Progress indicator
  • Restart button

Include Background

OptionBehavior
EnabledCanvas fills with artwork background color
DisabledCanvas is transparent

File Name

Enter a name for your component file:

  • Automatically converts to PascalCase for component name
  • Sanitizes invalid characters
  • Example: my-animationMyAnimation.tsx

Output Structure

TypeScript Output (.tsx)

tsx
'use client';
import React, { useEffect, useRef, useState } from 'react';
 
type Frame = {
  duration: number;
  cells: Array<{
    x: number;
    y: number;
    char: string;
    color: string;
    bgColor?: string;
  }>;
};
 
const frames: Frame[] = [...];
 
export const MyAnimation: React.FC = () => {
  const canvasRef = useRef<HTMLCanvasElement | null>(null);
  const [isPlaying, setIsPlaying] = useState(true);
  // ... rendering and playback logic
};
 
export default MyAnimation;

JavaScript Output (.jsx)

jsx
'use client';
import React, { useEffect, useRef, useState } from 'react';
 
const frames = [...];
 
export const MyAnimation = () => {
  const canvasRef = useRef(null);
  const [isPlaying, setIsPlaying] = useState(true);
  // ... rendering and playback logic
};
 
export default MyAnimation;

Usage Instructions

After exporting, use the component:

Download the exported file

Place in your React project's components folder

Import and use in your app

Basic Import

tsx
import MyAnimation from './MyAnimation';
 
function App() {
  return (
    <div>
      <h1>My ASCII Art</h1>
      <MyAnimation />
    </div>
  );
}

With Styling

tsx
import MyAnimation from './MyAnimation';
 
function App() {
  return (
    <div style={{ maxWidth: '800px', margin: '0 auto' }}>
      <MyAnimation />
    </div>
  );
}

Component Features

Auto-Play

  • Animation starts playing on mount
  • Loops continuously by default
  • No user interaction required

Canvas Rendering

  • Uses HTML5 Canvas for rendering
  • Efficient frame-by-frame updates
  • Respects original frame durations

Playback Controls (Optional)

When "Include Controls" is enabled:

  • Play/Pause - Toggle animation
  • Restart - Jump to frame 1
  • Progress - Visual indicator

Workflow Examples

Quick Embed

Select React Component export

Enable TypeScript if your project uses it

Disable controls for clean presentation

Export and drop into your project

Interactive Demo

Select React Component export

Enable Include Controls

Enable Include Background

Export

Integrate with your demo page

Portfolio Piece

Select React Component export

Choose TypeScript for type safety

Disable controls for seamless loop

Add to your portfolio site

Framework Compatibility

Next.js

The component includes 'use client' directive for Next.js App Router:

tsx
// Works automatically in Next.js 13+
import MyAnimation from '@/components/MyAnimation';
 
export default function Page() {
  return <MyAnimation />;
}

Vite/Create React App

Works out of the box:

tsx
import MyAnimation from './components/MyAnimation';
 
function App() {
  return <MyAnimation />;
}

Gatsby

Import as any other component:

tsx
import MyAnimation from '../components/MyAnimation';
 
const IndexPage = () => <MyAnimation />;

Customization

Styling the Container

Wrap the component for custom positioning:

tsx
<div className="animation-container">
  <MyAnimation />
</div>
css
.animation-container {
  width: 100%;
  max-width: 800px;
  aspect-ratio: 16/9;
}

Modifying the Component

After export, you can edit:

  • Canvas dimensions
  • Font settings
  • Playback speed
  • Control styling

Comparing to HTML Export

FeatureReactHTML
Framework requiredReact 18+None
IntegrationDirect importiframe/embed
CustomizableVeryLimited
File sizeSmallerLarger
StylingReact/CSSCSS only

Tips

  • Use TypeScript for better IDE support
  • Disable controls for background animations
  • Enable background if canvas should fill color
  • Test in your project before production use
  • Keep animations simple for best performance

Troubleshooting

Component Doesn't Render

  • Verify React 18+ is installed
  • Check import path is correct
  • Ensure file extension matches (.tsx vs .jsx)

Animation is Choppy

  • Reduce frame count in original
  • Simplify canvas content
  • Check browser performance

Controls Don't Work

  • Verify "Include Controls" was enabled
  • Check for CSS conflicts
  • Ensure component mounts properly

TypeScript Errors

  • Use .tsx extension
  • Verify React types are installed
  • Check tsconfig.json settings