Use the option() factory for single-select dropdown fields. Supports inline options, datasources, and internal stories.
Single-select dropdown field for Storyblok component schemas.
import { option } from '@jimdrury/storyblok-component-schema';
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Field key (internal name). |
description | string | No | Help text in the editor. |
tooltip | boolean | No | Show as tooltip. |
required | boolean | No |
| Editors must set a value. |
| Parameter | Type | Required | Description |
|---|---|---|---|
options | OptionItem[] ({ name, value }) | Yes | Choices shown in the dropdown. |
default_value | string | No | Pre-selected value. |
use_uuid | boolean | No | Store UUID instead of value where applicable. |
source | string | No | Data source configuration. |
datasource_slug | string | No | Storyblok datasource slug. |
external_datasource | string | No | External datasource identifier. |
filter_content_type | string[] | No | Limit internal story options by content type. |
folder_slug | string | No | Limit options to a folder. |
option({
name: 'color',
options: [
{ name: 'Red', value: 'red' },
{ name: 'Blue', value: 'blue' },
],
default_value: 'red',
});