Reference

Component props

Props on the Vega AST node and the shipped Vue Vega component.

Both entry points produce ['Vega', VegaNodeAttrs] nodes. The shipped Vue <Vega> component reads these props.

PropTypeDefaultDescription
specRecord<string, unknown>—Literal Vega / Vega-Lite spec (fenced block, body, or binding-resolved)
engine'vega-lite' | 'vega'autoChart engine; inferred from $schema / structure when omitted
widthnumber | string—Chart width in pixels
heightnumber | string—Chart height in pixels
output'svg' | 'img' | 'png'—Hint for SSR-capable paths; client Vega uses SVG
classstring''CSS class on the root element
:spec / other :propstring—Binding expressions preserved for @comark/binding (resolved before mount)

Type imports

import type { VegaNodeAttrs } from 'comark-vega'
import { mountVegaView } from 'comark-vega'

Invalid specs

Invalid specs soft-fail: the component shows a <pre class="vega-error"> message and does not throw. See Error handling.

Global defaults for output, engine, width, height, and config can come from frontmatter or the plugin factory.
Copyright © 2026