nuxt.config.ts and
then reference from any block by listing the option key in the globalOptions array inside
defineBlokkli(). Instead of duplicating a spacing or colorScheme option across every block
component, you define it centrally and let each block opt in.
Defining Global Options
Add your shared option definitions under theglobalOptions key in the blokkli module config:
type, label, default, and
type-specific properties all apply.
Using Global Options in a Block
Inside a block component, pass the keys you want to opt in to as an array toglobalOptions:
options
object returned by defineBlokkli().
Available Option Types
Every option — whether global or block-level — uses one of the following types:| Type | Editor widget | Value type | Example use |
|---|---|---|---|
text | Single-line text input | string | Short label, call-to-action text |
checkbox | Toggle checkbox | boolean | Show or hide an element |
checkboxes | Multi-select dropdown | string[] | Enable a set of features |
radios | Radio button group | string | Select a layout variant |
color | Color picker | string (#rrggbb) | Background or text color |
range | Range slider | number | Padding or spacing amount |
number | Numeric input | number | Column count, font size |
radios Display Variants
The radios type supports an optional displayAs property that changes how the choices are
rendered in the editor panel:
Controls the visual presentation of a
radios option in the editor UI.| Value | Appearance |
|---|---|
'radios' | Standard radio buttons (default) |
'grid' | Visual grid layout — useful for layout or column options |
'colors' | Color swatch grid — pairs well with colour-value keys |
'icons' | Icon buttons — ideal for alignment or direction choices |
Grouping Options
When a block exposes several options, you can group related ones together in the editor panel by adding agroup property to each option definition. blökkli collects options that share the
same group name into a labelled section, keeping the panel tidy for editors.
hero block shows two sections — Content (with the
heading field) and Appearance (with background colour and padding) — rather than a flat
unsorted list. You can use group on both block-level options and on global options that a block
has opted in to.
