Docs

API reference

React component syntax

The public primitives and file shape for an editable OpenSlideX presentation.

presentation.tsx

import {
  Deck,
  Slide,
  Text,
  definePresentation,
} from "@open-slidex/sdk/react";

export default definePresentation({
  title: "Quarterly update",
  component: function Presentation() {
    return (
      <Deck title="Quarterly update">
        <Slide id="slide-01" background="#F7F7F5" canvasWidth={1920} canvasHeight={1080} duration={5} fontSizeUnit="pt" theme="light">
          <Text id="slide-01-title" role="title" x={8} y={8} w={84} h={14} fontFamily="Arial" fontSize={42} fontWeight={700}>
            One clear claim
          </Text>
        </Slide>
      </Deck>
    );
  },
});

Native layer syntax

<Text id="headline" role="title" x={8} y={8} w={62} h={14} fontSize={42} fontWeight={700}>
  A clear headline
</Text>
<Image id="cover" x={70} y={8} w={22} h={40} src="assets/cover.webp" alt="Product shown on a desk" fit="cover" />
<Video id="demo" x={8} y={30} w={42} h={48} src="assets/demo.mp4" poster="assets/demo-poster.webp" />
<Shape id="accent" x={54} y={30} w={5} h={48} shape="rectangle" fill="#7C3AED" />
<Chart id="trend" x={62} y={55} w={30} h={23} type="line" data='[{"label":"Q1","value":42},{"label":"Q2","value":58}]' />
<Table id="owners" x={62} y={82} w={30} h={10} cells="Market|Owner;North|Ava" />
<Svg id="mark" x={8} y={84} w={8} h={8} src="assets/mark.svg" />
<HtmlEmbed id="imported-page" x={20} y={84} w={24} h={8} src="assets/source.html" />

Complete React API prop table

This table lists the current serializable React API fields recognized by OpenSlideX Workbench and its exporters. Shared layer fields appear once; each component page keeps its focused table too.

APIPropertyType / valuesRequiredDescription
Shared native-layer propsidstringYesStable, unique layer identifier. Required for every visible native layer.
xnumberYesLeft position as a percentage of the slide canvas.
ynumberYesTop position as a percentage of the slide canvas.
wnumberYesFrame width as a percentage of the slide canvas.
hnumberYesFrame height as a percentage of the slide canvas.
groupIdstring—Groups native children without adding a wrapper element.
groupNamestring—Human-readable name for a group in Workbench.
sharedIdstring—Matches the same layer type across adjacent Morph slides; unique within each slide.
rotationnumber—Clockwise rotation in degrees.
opacitynumber—Layer opacity from 0 to 1.
motionJSON string—Versioned declarative action sequence. Keep a complete static final frame.
interactionJSON string—Versioned click interaction for slide navigation or a link.
definePresentationtitlestringYesPresentation title. Keep it aligned with Deck title.
componentReact componentYesRoot component that returns exactly one Deck.
defineSlideXComponentnamestringYesStable display name for the registered local component.
componentReact componentYesPresentation-time implementation of the component.
propsliteral prop schema—Optional literal string, number, and boolean prop definitions, including required.
propsSchemasafeParse schema—Optional runtime schema; safeParse receives the component props.
assetReferences(props) => string[]—Optional local asset paths used by this component.
toMotionDoc(props) => ReactNode—Required when the component must expand into editable MDX or PPTX-native layers.
DecktitlestringYesDeck title; a valid presentation renders one Deck root.
childrenReactNodeYesOne or more Slide children.
SlideidstringYesStable slide identifier.
backgroundcolor string—Slide background color.
backgroundImagestring—Local background image path.
backgroundFitcover | contain | fill | scale-down—How a background image fills the canvas.
canvasWidthnumber—Target canvas width, typically 1920.
canvasHeightnumber—Target canvas height, typically 1080.
fontSizeUnit"pt"—Use pt so Text and Table font sizes are points.
durationnumber—Slide duration in seconds.
themestring—Presentation theme tone, such as light or dark.
slideTransitionstring—Transition to the next slide. Use morph only with compatible sharedId pairs.
transitionDurationnumber—Transition duration in seconds.
morphEasingstring—Easing for a Morph transition.
morphFadeUnmatchedboolean—Whether unmatched layers fade during Morph.
morphShapeSoftnessnumber—Softness for compatible shape Morph.
morphShapePrecisionnumber—Shape sampling precision for Morph.
morphCurveX1 / morphCurveY1 / morphCurveX2 / morphCurveY2number—Control points when morphEasing is custom.
TextchildrenReactNodeYesText content for the layer.
role"title" | string—Use title for the primary slide title.
fontFamilystring—Font family name.
fontSizenumber—Font size in points when Slide uses fontSizeUnit="pt".
fontWeightnumber | string—Font weight, such as 400 or 700.
fontStyle"italic"—Italic text style.
colorcolor string—Text color.
backgroundcolor string—Text-frame background color.
radiusnumber—Corner radius for the text frame.
lineHeightnumber—Line-height multiplier.
letterSpacingnumber—Letter spacing in points.
textAlignleft | center | right—Horizontal text alignment.
textVerticalAligntop | middle | bottom—Vertical text alignment in the frame.
listTypebullet | ordered—Optional list formatting.
listStartnumber—Starting number for an ordered list.
ImagesrcstringYesPortable local image path, normally under assets/.
altstring—Alternative description for the image.
fitcover | contain | fill | scale-down—How image content fits its frame.
cropX / cropYnumber—Image translation within its frame, in percent.
scaleX / scaleYnumber—Image-content scale on each axis.
radiusnumber—Frame corner radius.
filterstring—Paper image-filter identifier.
filterPresetstring—Preset for the selected image filter.
filterDistortion / filterSize / filterAngle / filterContrast / filterSpeed / filterDetailnumber—Fine controls for the selected paper filter.
VideosrcstringYesLocal MP4/WebM path, direct URL, or supported YouTube URL.
posterstring—Image shown before playback or in static rendering.
fitcover | contain | fill | scale-down—How video content fits its frame.
controlsboolean—Shows playback controls; defaults to true.
loopboolean—Loops playback; defaults to true.
mutedboolean—Mutes and enables inline autoplay; defaults to true.
radiusnumber—Frame corner radius.
Shapeshaperectangle | circle | triangle | diamond | star | line | arrow | chevron | hexagon | parallelogramYesGeometry to draw.
fillcolor string—Interior color.
strokecolor string—Outline or line color.
strokeWidthnumber—Outline or line width.
radius / borderRadiusnumber—Rounded rectangle corner radius.
cornernumber—Continuous-corner treatment.
points / sidesnumber—Star points or polygon sides.
lineStylesolid | dashed | dotted—Line stroke pattern.
arrowStart / arrowEndnone | arrow | circle | bar—Line endpoint decorations.
arrowStartSize / arrowEndSizenumber—Endpoint size as a percentage.
shapeImageSrcstring—Optional image clipped inside a non-line shape.
shapeImageAltstring—Description for the shape image.
shapeImageFitcover | contain | fill | scale-down—How the shape image fills its geometry.
shapeImageCropX / shapeImageCropY / shapeImageScaleX / shapeImageScaleYnumber—Shape-image crop and scale controls.
masknone | alpha | luma | clip—Shape mask mode.
operationnone | subtract | intersect | exclude—Shape boolean treatment.
Charttypebar | line | area | pie | donut | scatterYesChart visualization type.
dataJSON stringYesOne to 24 rows; every row needs a finite numeric value and may include label, x, size, and color.
chartDataByTypeJSON string—Optional data sets keyed by chart type.
chartPresetexecutive | minimal | vivid—Visual preset.
chartThemelight | dark-gold—Chart-specific theme.
paletteaurora | editorial | gilded | ocean | sunset—Named color palette.
colorModepalette | single | emphasis | gradient—Color distribution strategy.
emphasisIndexnumber—Data point emphasized by color mode.
annotationIndex / annotationText / annotationColornumber | string—Optional annotation target, label, and color.
barGapcompact | balanced | airy—Spacing for bar charts.
barRadius / areaOpacity / donutHolenumber—Rounded bars, area fill opacity, or donut hole size.
lineSmoothboolean—Smoothes a line or area path.
showAxes / showGrid / showLabelsboolean—Shows axes, grid, or labels.
labelMode / labelColorall | value | category | none | color—Label visibility mode and color.
numberFormatauto | integer | decimal | percent | currency | compact—Value formatting.
decimals / currencynumber | string—Decimal places and currency code or symbol.
sortinput | ascending | descending—Data ordering.
referenceValue / referenceLabel / referenceColornumber | string—Optional reference line value, label, and color.
chartMotionauto | grow | draw | sweep | pop | none—Chart entrance motion.
TablecellsstringYesCell data: pipes separate columns and semicolons separate rows.
rowsnumber—Number of rows, from 1 through 50.
columns / colsnumber—Number of columns, from 1 through 50.
columnLabels / rowLabelsstring—Serialized labels for columns or rows.
columnWidths / rowHeightsstring—Serialized fractional track sizes.
cellOverridesJSON string—Per-cell visual overrides created by Workbench.
fontFamily / fontSize / fontWeightstring | number—Table type styling; fontSize is in points.
color / textColorcolor string—Table text color.
background / backgroundColor / bgcolor string—Table background color.
cellBackground / stripeBackgroundcolor string—Cell fill and alternating-row fill.
borderColor / borderWidth / borderStylecolor | number | solid | dashed | dotted—Table border styling.
textAlign / textVerticalAlignleft | center | right / top | middle | bottom—Cell alignment.
cellPaddingX / cellPaddingYnumber—Horizontal and vertical cell padding in pixels.
SvgsrcstringYesScript-free local SVG asset path.
stagenumber—SVG animation stage index.
stageDurationnumber—SVG stage duration in seconds.
easingstring—Easing for the SVG stage.
sharedScenestring—Optional scene key shared across slides.
HtmlEmbedsrcstringYesControlled local HTML asset path.
pagenumber—HTML presentation page to show; starts at 1.
sharedScenestring—Optional scene key shared across slides.

Start with one valid document

Default-export definePresentation({ title, component }). The component must render one Deck with a matching title and one or more Slide children. Import public primitives only from @open-slidex/sdk/react.

Deck and Slide establish the document; Text, Image, Video, Svg, Chart, Table, Shape, and HtmlEmbed create native layers. Do not write internal names such as ImageBlock or SvgBlock in React source.

Use literal frames

Every visible native layer needs a stable, unique id plus literal x, y, w, and h values. These are percentages of the slide canvas. Text fontSize values use points when the Slide sets fontSizeUnit="pt".

Use literal, serializable values when a property should be visible and editable in Canvas or Inspector. Computed expressions, loops, spreads, hooks, and conditions remain code-only and are not guaranteed to round-trip through visual editing.

Keep the sandbox portable

Use verified relative assets under the deck's assets/ directory. HtmlEmbed accepts controlled, imported local HTML; Svg accepts script-free local SVG. Do not use absolute paths, Base64 or blob URLs, arbitrary HTML, event handlers, network calls, Node APIs, or external npm imports.

Card, Metric, Stack, Group, Title, Icon, and Notes are not supported React primitives. Use the native layers above instead.