The Element SDK is in beta and not yet publicly released — APIs may change without notice.
The three element categories and the defineElement authoring primitive
Every element belongs to one of three categories. The category determines how the element is placed on the board and which render functions you must provide.
Renders within a scene alongside its siblings. Use this for elements that flow with narrative content — callouts, equations, cards, rich text blocks.
Has both an inline state and a full-board state. Which state is used depends on the element's mode attribute in Chalk — mode: inline (default) or mode: environment. The code editor and diagram elements are hybrid: they appear inline in a list of elements, but expand to take the full board when placed alone in a scene's detail zone.
You must provide both render (inline) and renderEnvironment (full-board):
Always takes the full board. Use this for elements that need the full visual space and toolbar integration — interactive simulations, IDEs, quiz environments.
Environment elements can also contribute toolbar buttons:
defineElement is the single authoring primitive. Pass it an object describing your element and it returns the same object after validation.
defineElement throws at startup if required fields are missing — for example, if you declare category: 'environment' without providing renderEnvironment. This makes authoring mistakes visible immediately rather than at render time.
The Chalk identifier(s) this element handles. Every element needs a unique kind. Pass an array to handle multiple identifiers with a single definition:
Later registrations for the same kind override earlier ones, so you can replace a definition without reloading the page.
The inline render function. Receives resolved props (from your declared schema) and an ElementApi. Must return a React element or null.
Required for inline and hybrid categories.
The full-board render function. Same signature as render. Required for environment and hybrid categories, ignored for inline.
Optional declarative attribute schema. When declared, the SDK resolves your element's Chalk attributes into a typed props object before your render function runs — you read props.colour instead of parsing the raw attribute list manually. See Attribute Schemas.
Declares which animation modes your element supports:
Declare only the modes you use. The runtime wires the appropriate hooks based on this declaration.
Provides toolbar buttons, toggles, and separators for environment (and hybrid-environment) elements. See Toolbar.
Optional human-readable label shown in the plugin marketplace and developer debugging tools.
Render functions are called as ordinary React function components. useState, useEffect, useRef, and any other hook all work:
Definitions must be registered before they can render. Call ElementRegistry.register once per definition, typically at application startup:
Other registry methods:
If ElementRenderer encounters a kind that is not registered, it falls back to rendering the raw element JSON as a debug view rather than throwing. This lets you register definitions incrementally without breaking the renderer for already-registered elements.