# @openmaic/renderer React component for rendering PPTist-style `Slide` JSON. Extracted from [OpenMAIC](https://github.com/THU-MAIC/OpenMAIC). > **v1 = read-only canvas.** Editing (selection, drag/resize, ProseMirror inline editor) is planned for v2. ## Install ```bash pnpm add @openmaic/renderer # or npm install @openmaic/renderer ``` Required peers: - `react >= 18` - `react-dom >= 18` - `motion >= 11` - `tailwindcss >= 4` — **the package emits Tailwind 4 arbitrary-value classes, consumers must use Tailwind 4** Optional peers (install only if your slides use the corresponding element type): - `echarts >= 5` — for chart elements - `shiki >= 1` — for code elements ## Quickstart ```tsx import { SlideCanvas, type Slide } from '@openmaic/renderer'; const slide: Slide = { id: 'demo-1', viewportSize: 1000, viewportRatio: 0.5625, theme: { backgroundColor: '#ffffff', themeColors: ['#5b8def'], fontColor: '#222222', fontName: 'sans-serif', }, elements: [ { type: 'text', id: 't1', left: 100, top: 80, width: 800, height: 60, rotate: 0, content: '

Hello, Slide

', defaultFontName: 'sans-serif', defaultColor: '#222', }, ], background: { type: 'solid', color: '#ffffff' }, }; export default function Demo() { return (
); } ``` The canvas auto-fits its parent container. The parent must have a defined `width × height`. ## API ### `` The main read-only entry. Reads everything from props; zero global state. ```ts interface SlideCanvasProps { slide?: Slide; // required unless via scale?: number; // omit = auto-fit container background?: SlideBackground; // overrides slide.background effects?: SlideEffects; // laser / spotlight / highlight / zoom, all default off renderImage?: (el, src) => ReactNode; renderVideo?: (el) => ReactNode; onElementClick?: (el, event) => void; className?: string; style?: CSSProperties; } ``` ### Play-time effects All effects are off by default. Pass any combination via `effects`: ```tsx ``` ### Media injection slots The package's `BaseImageElement` and `BaseVideoElement` render plain `` / `