A powerful and flexible TypeScript-based Canvas Editor SDK for building sophisticated design tools and image editing applications in React.
-
🎨 Rich Canvas Editing
- Drag and drop functionality
- Rotation and resizing of elements
- Layer management (bring forward/send backward)
- Background customization
- Undo/Redo support
-
📝 Text Elements
- Add and edit text elements
- Customize font properties
- Real-time text editing
- Text element rotation and resizing
-
🖼️ Image Elements
- Upload images from files
- Add images from URLs
- Image transformation capabilities
- Image element rotation and resizing
- Custom clipping paths support
-
🔷 Shape Elements
- Add various shape elements
- Customize shape properties
- Shape transformation support
-
💾 Persistence
- Automatic state saving
- Import/Export design functionality
- Local storage support
npm install canvas-editor-sdk
# or
yarn add canvas-editor-sdk
import { ReactCanvasEditor } from 'canvas-editor-sdk';
function App() {
const handleDesignChange = (design) => {
console.log('Design updated:', design);
};
return (
<ReactCanvasEditor
onDesignChange={handleDesignChange}
/>
);
}
import { ReactCanvasEditor } from 'canvas-editor-sdk';
function App() {
const initialDesign = {
width: 800,
height: 600,
backgroundColor: '#ffffff',
elements: []
};
return (
<ReactCanvasEditor
initialDesign={initialDesign}
onDesignChange={(design) => {
// Handle design changes
}}
/>
);
}
Prop | Type | Description |
---|---|---|
initialDesign |
CanvasDesign |
Optional initial design configuration |
onDesignChange |
(design: CanvasDesign) => void |
Callback fired when design changes |
interface CanvasDesign {
width: number;
height: number;
backgroundColor: string;
elements: CanvasElement[];
}
The SDK supports multiple element types:
TextElement
: For text contentImageElement
: For images and photosShapeElement
: For geometric shapes
- Double-click to edit text elements
- Customize font properties
- Rotate and resize text elements
- Support for file uploads
- URL-based image imports
- Image transformations
- Custom clipping paths
- Zoom and pan
- Element selection
- Multi-element manipulation
- History management (undo/redo)
The editor automatically saves the current state to localStorage and supports:
- Importing designs from JSON
- Exporting designs to JSON
- Automatic state recovery on page reload
The editor supports extensive customization through:
- Custom color schemes
- Template support
- Element style customization
- Tool configurations
Contributions are welcome! Please feel free to submit a Pull Request.
- Built with React and TypeScript
- Uses modern web technologies for optimal performance
- Designed with flexibility and extensibility in mind
Created by @Anas-Dew