SlideCanvas

A fixed-ratio slide stage that scales to fit, with free-positioned elements you can select, drag, resize, and nudge with the keyboard.

Installation

npx dafink-ui add slide-canvas

Demo

Q3 2026

Quarterly review

Growth, retention, and what is next

Props

NameTypeDefaultDescription
elementsT[] (T extends SlideElement)-Elements on the slide: `{ id, label, x, y, width, height }` in logical px, plus any fields of your own. Array order is stacking order.
onElementsChange(elements: T[]) => void-Called with the updated array on move, resize, or delete.
renderElement(element: T, state: { selected, editing }) => ReactNode-Renders an element. Content is non-interactive unless the element is being edited.
renderToolbar(element: T, state) => ReactNode-Floating toolbar shown above the selected element at normal size. Alt+F10 focuses it.
widthnumber1280Logical slide width. The stage scales to fit its container.
heightnumber720Logical slide height.
stageStyleCSSProperties-Styles on the stage only (not the toolbar), e.g. token variables that theme the slide.
backdropReactNode-Decorative layer behind the elements (e.g. an ambient effect). Hidden from assistive tech, never interactive.
scalenumber-Fixed zoom (1 = 100%). Omit to fit the container width.
onScaleChange(scale: number) => void-Reports the effective scale, e.g. for a zoom percentage.
backgroundstring-Any CSS background for the stage. Defaults to the surface token.
gridSizenumber-Snap moves and resizes to this grid, in logical px.
snapToElementsbooleantrueSnap pointer drags to other elements' edges and centers, with guide lines. Hold Alt to bypass.
selectedIdstring | null-Controlled selection. Omit to let the canvas manage it.
onSelectedIdChange(id: string | null) => void-Called when the selection changes.
canEdit(element: T) => boolean-Which elements can enter editing mode (double-click or Enter). Omit to disable editing.
editingIdstring | null-Controlled editing element. Omit to let the canvas manage it.
onEditingIdChange(id: string | null) => void-Called when editing starts or stops.
drawingbooleanfalseDraw mode: pointer drags draw a new region (crosshair + dashed preview) instead of moving elements.
onDraw(from: SlidePoint, to: SlidePoint) => void-Called when a draw-mode drag ends, with grid-snapped points in slide px.
readOnlybooleanfalsePresentation mode: no selection, dragging, resizing, or keyboard editing.
classNamestring''Additional classes on the outer frame.

Accessibility

Each element is a focusable role="button" named by its label, with aria-pressed reflecting selection. Elements sit in the normal Tab order (stacking order), and focusing one selects it, so everything a pointer can do (move, resize, delete) is also available from the keyboard. After each keyboard move or pointer drag, a polite live region announces the element's new position and size. The corner resize handles are pointer-only and hidden from assistive tech; Alt + Arrow keys resize instead.

KeyFunction
tabMoves to the next element and selects it.
arrowMoves the element 1px, or one grid step when gridSize is set.
shift+arrowMoves the element 10px.
alt+arrowResizes the element from its bottom-right corner.
enterEnters editing mode on an editable element, so keys go to its content.
alt+f10Moves focus into the floating toolbar, when there is one. Escape returns to the element.
deleteRemoves the element.
escapeExits editing mode, or clears the selection when not editing.