LLM-first developer tool for generating Component Catalogues
Controls allow users to interactively modify component properties in the playground. They’re defined in component.json under playground.controls.
Text input for string values.
{
"label": {
"type": "text",
"label": "Label",
"defaultValue": "Button",
"placeholder": "Enter label..."
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
string | Initial value |
placeholder |
string | Placeholder text |
Numeric input with optional min/max/step.
{
"count": {
"type": "number",
"label": "Count",
"defaultValue": 5,
"min": 0,
"max": 100,
"step": 1
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
number | Initial value |
min |
number | Minimum value |
max |
number | Maximum value |
step |
number | Increment step |
Checkbox for true/false values.
{
"disabled": {
"type": "boolean",
"label": "Disabled",
"defaultValue": false
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
boolean | Initial value |
Dropdown for selecting from options.
{
"variant": {
"type": "select",
"label": "Variant",
"defaultValue": "primary",
"options": ["primary", "secondary", "danger"]
}
}
With custom labels:
{
"size": {
"type": "select",
"label": "Size",
"defaultValue": "md",
"options": [
{ "label": "Small", "value": "sm" },
{ "label": "Medium", "value": "md" },
{ "label": "Large", "value": "lg" }
]
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
string | Initial value |
options |
array | String values or {label, value} objects |
Radio buttons for mutually exclusive options.
{
"alignment": {
"type": "radio",
"label": "Alignment",
"defaultValue": "left",
"options": ["left", "center", "right"]
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
string | Initial value |
options |
array | String values or {label, value} objects |
Color picker input.
{
"accentColor": {
"type": "color",
"label": "Accent Color",
"defaultValue": "#3b82f6"
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
string | Initial hex color |
Slider for numeric ranges.
{
"opacity": {
"type": "range",
"label": "Opacity",
"defaultValue": 100,
"min": 0,
"max": 100,
"step": 5
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
number | Initial value |
min |
number | Minimum value (required) |
max |
number | Maximum value (required) |
step |
number | Increment step |
JSON editor for complex objects/arrays.
{
"items": {
"type": "json",
"label": "Items",
"defaultValue": [
{ "id": 1, "name": "Item 1" },
{ "id": 2, "name": "Item 2" }
]
}
}
| Option | Type | Description |
|---|---|---|
label |
string | Display label |
defaultValue |
any | Initial JSON value |
{
"id": "button",
"title": "Button",
"status": "stable",
"kind": "standalone",
"exports": {
"customElement": "my-button"
},
"playground": {
"primaryScenarioId": "button-default",
"controls": {
"variant": {
"type": "select",
"label": "Variant",
"defaultValue": "primary",
"options": [
{ "label": "Primary", "value": "primary" },
{ "label": "Secondary", "value": "secondary" },
{ "label": "Outline", "value": "outline" },
{ "label": "Danger", "value": "danger" }
]
},
"size": {
"type": "radio",
"label": "Size",
"defaultValue": "medium",
"options": ["small", "medium", "large"]
},
"disabled": {
"type": "boolean",
"label": "Disabled",
"defaultValue": false
},
"loading": {
"type": "boolean",
"label": "Loading",
"defaultValue": false
},
"width": {
"type": "range",
"label": "Min Width",
"defaultValue": 100,
"min": 50,
"max": 300,
"step": 10
}
}
}
}
setAttribute()json controls update DOM properties directlyjson) generate a <script> tagdefaultValue for predictable behavior