React Skia brings the power of Skia Graphics Library to React applications running in browsers. Built on top of Google's CanvasKit-WASM, it provides a React-friendly API for creating complex 2D graphics with hardware acceleration.
โ ๏ธ Development Status: This project is currently in active development and not yet published to npm. Please clone and build from source.
- ๐ Hardware Accelerated - GPU-powered rendering via CanvasKit-WASM
- ๐จ Basic Graphics API - Rectangle, Circle, Path, Text rendering
- ๐ช TypeScript First - Full type safety and IntelliSense support
- ๐ Web Optimized - Built for modern browsers with WebAssembly
- ๐ฎ React Integration - Familiar component-based API
Clone and run the project locally:
# Clone the repository
git clone https://github.com/your-username/react-skia.git
cd react-skia
# Install dependencies
pnpm install
# Start the development playground
pnpm dev
Visit http://localhost:5173
to explore the interactive playground with live demos.
Once you've cloned and built the project, you can use it in your applications:
import { Canvas, Circle, LinearGradient, Rect, Text } from "react-skia";
function App() {
return (
<Canvas width={400} height={300}>
{/* Basic shapes */}
<Rect x={10} y={10} width={100} height={80} color="#FF6B6B" />
<Circle cx={200} cy={50} r={30} color="#4ECDC4" />
{/* Text rendering */}
<Text x={10} y={150} text="Hello Skia Web!" fontSize={20} color="#333" />
{/* Gradient effects */}
<Rect x={250} y={80} width={120} height={60}>
<LinearGradient
start={{ x: 0, y: 0 }}
end={{ x: 120, y: 0 }}
colors={["#667eea", "#764ba2"]}
/>
</Rect>
</Canvas>
);
}
Explore our documentation and examples:
- Live Playground - Interactive demos and examples
- API Reference - TypeScript interfaces and type definitions
- Source Code - Core library implementation
The playground includes these demos:
- ๐ธ Basic Shapes - Rectangles, circles, and stroke styles
- ๐ Text Rendering - Basic text with font size and color controls
- ๐จ Path Drawing - SVG-compatible path rendering
- ๐ Gradient Effects - Linear and radial gradients
- ๐ฅ Groups & Opacity - Layering and transparency controls
- ๐ผ๏ธ Image Rendering - Basic image loading and display
- ๐๏ธ Complex Scenes - Simple graphics compositions
- ๐ Performance Tests - Static rendering test with 100 shapes
react-skia/
โโโ packages/
โ โโโ react-skia/ # Core library
โ โโโ src/
โ โ โโโ components/ # React components (Canvas, Rect, etc.)
โ โ โโโ renderer/ # Skia rendering engine
โ โ โโโ hooks/ # React hooks
โ โ โโโ types.ts # TypeScript definitions
โ โโโ package.json
โโโ apps/
โโโ playground/ # Interactive demo application
โโโ src/
โโโ components/
โโโ demos/ # Example implementations
# Install dependencies
pnpm install
# Build the library
pnpm build
# Run development server
pnpm dev
# Type checking
pnpm check-types
# Linting
pnpm lint
pnpm dev
- Start development server with hot reloadpnpm build
- Build production bundlepnpm lint
- Run ESLintpnpm check-types
- TypeScript type checkingpnpm format
- Format code with Prettier
The root container for all Skia graphics:
<Canvas width={400} height={300}>
{/* Your graphics components */}
</Canvas>
// Rectangle
<Rect x={10} y={10} width={100} height={50} color="#FF6B6B" />
// Circle
<Circle cx={100} cy={100} r={50} color="#4ECDC4" />
// Text
<Text x={10} y={100} text="Hello World" fontSize={20} color="#333" />
// SVG Paths
<Path
path="M 10 80 Q 95 10 180 80"
color="#F39C12"
strokeWidth={4}
style="stroke"
/>
// Groups with opacity
<Group opacity={0.8}>
<Rect x={0} y={0} width={100} height={100} color="#E67E22" />
</Group>
// Gradients
<Rect x={10} y={10} width={200} height={100}>
<LinearGradient
start={{ x: 0, y: 0 }}
end={{ x: 200, y: 0 }}
colors={["#667eea", "#764ba2"]}
/>
</Rect>
React Skia is built for performance:
- Hardware Acceleration: Leverages GPU through CanvasKit-WASM
- Efficient Rendering: Direct canvas manipulation with minimal React overhead
- Memory Management: Automatic cleanup of Skia objects
- Optimized for Modern Browsers: Built on proven CanvasKit-WASM technology
React Skia provides:
- ๐ฏ GPU Acceleration - Hardware-accelerated rendering via WebGL
- ๐ Efficient Updates - Smart component diffing and batching
- ๐ฆ Tree Shakeable - Import only what you need
- ๐งน Memory Safe - Automatic resource cleanup
Note: Comprehensive performance benchmarks are planned for future releases. Current implementation includes a basic stress test with 100+ static shapes in the playground.
We welcome contributions! This project is in active development.
- Fork the repository
- Clone your fork:
git clone https://github.com/your-username/react-skia.git
- Install dependencies:
pnpm install
- Create a feature branch:
git checkout -b feature/amazing-feature
- Make your changes and add tests
- Build the project:
pnpm build
- Test your changes:
pnpm dev
(run playground) - Commit your changes:
git commit -m 'feat: add amazing feature'
- Push to your fork:
git push origin feature/amazing-feature
- Open a Pull Request
This project follows strict coding standards:
- ESLint: Google Style Guide compliance
- Prettier: Consistent code formatting
- TypeScript: Strict type checking
- Conventional Commits: Standardized commit messages
- โ Basic shapes (Rect, Circle, Path)
- โ Basic text rendering
- โ SVG-compatible path drawing
- โ Linear and radial gradients
- โ Groups and opacity control
- โ Basic image rendering with fit modes
- โ Blur and color matrix filters
- โ TypeScript support
- โ React 19 compatibility
- ๐ง Animation system (useSharedValue)
- ๐ง Touch/mouse event handling
- ๐ง Clipping and masking
- ๐ง Gesture recognition
- ๐ง Advanced transforms
- ๐ NPM package publication
- ๐ Animation system (useSharedValue)
- ๐ Touch/mouse event handling
- ๐ Advanced font and text features
- ๐ Performance optimizations
- ๐ Clipping and masking
- ๐ Advanced transforms
- ๐ Performance profiling tools
React Skia requires WebAssembly support and works on these modern browsers:
- โ Chrome 57+ (March 2017)
- โ Firefox 52+ (March 2017)
- โ Safari 11+ (September 2017)
- โ Edge 16+ (October 2017)
Note: WebAssembly is required for CanvasKit-WASM functionality. Older browsers without WebAssembly support are not compatible.
- Google Skia Team - For the powerful Skia graphics library
- CanvasKit - For the WebAssembly port of Skia
- Shopify's React Native Skia - For the API design inspiration
๐ Get Started โข ๐ Documentation โข ๐ฎ Examples โข ๐ค Contributing
Made with โค๏ธ by kim-jaedeok