TheDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/andresilva-cc/grafex/llms.txt
Use this file to discover all available pages before exploring further.
CompositionConfig interface is the primary way to declare the output settings for a composition. Export a config constant from your .tsx file and Grafex reads it before rendering — no CLI flags required for the common case. Every field is optional, so you can start with just width and height and add more as your needs grow.
CompositionConfig
Width of the composition viewport in logical pixels. Used as the browser viewport width before any scale factor is applied. Typically set to the desired output width — for example,
1200 for an Open Graph image.Height of the composition viewport in logical pixels. Typically set to the desired output height — for example,
630 for an Open Graph image.Device pixel ratio applied to the viewport. A value of
2 produces retina-quality output: a 1200×630 composition at scale: 2 renders a 2400×1260 physical-pixel image while the layout still sees a 1200×630 viewport. The physical pixel dimensions equal width × scale and height × scale.Image format for the exported file. Use
'jpeg' for photographs or compositions with complex gradients where a smaller file size is acceptable. Use 'png' (the default) for compositions that require transparency or crisp text.JPEG compression quality on a scale from
1 (smallest file, lowest quality) to 100 (largest file, highest quality). Only applied when format is 'jpeg' — this field has no effect on PNG output.Paths to local font files (
.ttf, .otf, .woff, .woff2) to load before rendering. Paths are resolved relative to the composition file. Fonts loaded here are available to all CSS font-family declarations in the composition.Paths to external CSS files to inject into the page
<head> before rendering. Paths are resolved relative to the composition file. This field accepts any CSS — plain stylesheets, Tailwind output, Sass output, or any other generated .css file.Array fields like
css and fonts replace the base config value when a variant overrides them — they do not merge. If a variant specifies css: ['./dark.css'], only dark.css is loaded for that variant.A named map of variant configurations. Each key becomes the variant name and each value is a
VariantConfig that inherits all base config fields, then overrides only the ones you specify. When variants are defined, the CLI renders all of them by default and names the output files after the variant keys.Arbitrary attributes to set on the root
<html> element. Attribute values are HTML-escaped automatically. This is useful for theming systems that rely on CSS selectors like :root[data-theme="dark"], including Tailwind CSS v4.Merge precedence
When rendering with variants, CLI flags, or library API options, settings are resolved in this order (highest to lowest precedence):- CLI flags /
RenderOptionspassed torender()orrenderAll() - The matching
VariantConfigentry - The base
CompositionConfig
props are shallow-merged across all three levels. css and fonts arrays replace the base value — they do not concatenate. htmlAttributes from a variant are spread over the base attributes.