Blockstudio
BlocksAttributes

Field Types

Blockstudio provides a variety of field types for building block interfaces.

Guide: Field Patterns CookbookPractical recipes: conditional groups, smart selects, repeaters, and queryable storage.

General Properties

All fields share these common properties:

PropertyTypeDescription
idstringUnique identifier for the attribute
typestringThe field type
labelstringDisplay label shown in the editor
descriptionstringDescription text shown below the label
defaultmixedDefault value for the field
fallbackmixedFallback value when field is empty
helpstringHelp text displayed below the field
hiddenbooleanHide the field from the UI
switchbooleanDisplay a toggle that can disable the field. Defaults to false.
conditionsarrayConditional logic rules

attributes

Renders data attribute inputs.

{
  "type": "attributes"
}

Properties

PropertyTypeDescription
defaultarrayDefault value that should be applied when first adding the block.
fallbackarrayFallback value that that will display when field value is empty.
linkbooleanEnables link selection from dropdown.
mediabooleanEnables media selection from dropdown.

checkbox

Renders a set of checkbox inputs.

{
  "type": "checkbox",
  "options": [
    {
      "value": "option1",
      "label": "Option 1"
    },
    {
      "value": "option2",
      "label": "Option 2"
    }
  ]
}

Properties

PropertyTypeDescription
defaultarray | string | numberDefault value that should be applied when first adding the block.
fallbackarray | string | numberFallback value that that will display when field value is empty.
optionsarrayOptions to choose from.
returnFormatstringSpecifies the return format value.
populateobject

classes

Renders a field to select CSS classes.

{
  "type": "classes"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
tailwindbooleanWhether to enable Tailwind classes for this input field.

code

Renders a code editor.

{
  "type": "code"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
autoCompletionbooleanWhether to enable autocompletion or not.
foldGutterbooleanWhether to show the fold gutter or not.
heightstringThe height of the editor.
languagestringThe language to use for syntax highlighting.
lineNumbersbooleanWhether to display line numbers or not.
maxHeightstringThe maximum height of the editor.
minHeightstringThe minimum height of the editor.
popoutbooleanWhether to show a button that opens the editor in a popup window.

color

Renders a color palette and color picker.

{
  "type": "color",
  "options": [
    {
      "value": "option1",
      "label": "Option 1"
    },
    {
      "value": "option2",
      "label": "Option 2"
    }
  ]
}

Properties

PropertyTypeDescription
optionsarray
populateobject
clearablebooleanWhether the palette should have a clearing button or not.
disableCustomColorsbooleanWhether to allow custom color or not.

date

Renders a date picker.

{
  "type": "date"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
startOfWeeknumberThe day that the week should start on. 0 for Sunday, 1 for Monday, etc.

datetime

Renders a date and time picker.

{
  "type": "datetime"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
is12HourbooleanWhether we use a 12-hour clock. With a 12-hour clock, an AM/PM widget is displayed and the time format is assumed to be MM-DD-YYYY (as opposed to the default format DD-MM-YYYY).

files

Renders a button to the media library. Picked items can be reordered inline.

{
  "type": "files",
  "min": 0,
  "max": 100,
  "multiple": false
}

Properties

PropertyTypeDescription
defaultarray | object | numberDefault value that should be applied when first adding the block.
fallbackarray | object | numberFallback value that that will display when field value is empty.
addToGallerybooleanIf true, the gallery media modal opens directly in the media library where the user can add additional images. If false the gallery media modal opens in the edit mode where the user can edit existing images, by reordering them, remove them, or change their attributes. Only applies if gallery === true.
allowedTypesarray | stringArray with the types of the media to upload/select from the media library. Each type is a string that can contain the general mime type e.g: 'image', 'audio', 'text', or the complete mime type e.g: 'audio/mpeg', 'image/gif'. If allowedTypes is unset all mime types should be allowed.
gallerybooleanIf true, the component will initiate all the states required to represent a gallery. By default, the media modal opens in the gallery edit frame, but that can be changed using the addToGalleryflag.
maxnumberMaximum amount of files that can be added.
minnumberMinimum amount of files that can be added.
multiplebooleanWhether to allow multiple selections or not.
sizebooleanAdds a media size dropdown to the field.
textMediaButtonstringMedia button text.
titlestringTitle displayed in the media modal.
returnFormatstringSpecifies the return format value.
returnSizestringThe media size to return when using the URL return format.

gradient

Renders a gradient palette and gradient picker

{
  "type": "gradient",
  "options": [
    {
      "value": "option1",
      "label": "Option 1"
    },
    {
      "value": "option2",
      "label": "Option 2"
    }
  ]
}

Properties

PropertyTypeDescription
optionsarray
populateobject
clearablebooleanWhether the palette should have a clearing button or not.
disableCustomGradientsbooleanWhether to allow custom color or not.

group

Renders multiple fields in an (optionally) collapsible container.

{
  "type": "group"
}

Properties

PropertyTypeDescription
titlestringTitle text. It shows even when the component is closed.
openedbooleanWhen set to true, the component will remain open regardless of the initialOpen prop and the
initialOpenbooleanWhether or not the panel will start open.
scrollAfterOpenbooleanScrolls the content into view when visible.
classstringCustom CSS class that will be applied to the group.
styleobjectCustom CSS styles that will be applied to the group.
attributesarrayAccepts all other field types besides another tabs.

icon

Renders an SVG icon from an icon set.

{
  "type": "icon"
}

Properties

PropertyTypeDescription
defaultobjectDefault value that should be applied when first adding the block.
fallbackobjectFallback value that that will display when field value is empty.
setsarray | stringWhich icon set to include. Leave empty to include all.
subSetsarray | stringWhich sub icon set to include. Leave empty to include all.
returnFormatstringThe format to return the icon in.

Renders a link control to choose internal or external links.

{
  "type": "link"
}

Properties

PropertyTypeDescription
defaultobjectDefault value that should be applied when first adding the block.
fallbackobjectFallback value that that will display when field value is empty.
hasRichPreviewsbooleanWhether rich previews should be shown when adding an URL.
noDirectEntrybooleanWhether to allow turning a URL-like search query directly into a link.
noURLSuggestionbooleanWhether to add a fallback suggestion which treats the search query as a URL.
opensInNewTabbooleanAdds a toggle control to the link modal.
showSuggestionsbooleanWhether to present suggestions when typing the URL.
textButtonstringCustom text that should be displayed inside the link button.
withCreateSuggestionbooleanWhether to allow creation of link value from suggestion.

message

Renders a message with custom content.

{
  "type": "message"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
valuestringThe message to display. Block and attribute data is available in bracket syntax, e.g.: {block.title} or {attributes.text}

number

Renders a number input.

{
  "type": "number",
  "min": 0,
  "max": 100,
  "step": 1
}

Properties

PropertyTypeDescription
defaultnumberDefault value that should be applied when first adding the block.
fallbacknumberFallback value that that will display when field value is empty.
dragDirectionstringDetermines the drag axis to increment/decrement the value.
dragThresholdnumberIf isDragEnabled is true, this controls the amount of px to have been dragged before the value changes.
hideHTMLArrowsbooleanIf true, the default input HTML arrows will be hidden.
isShiftStepEnabledbooleanIf true, enables mouse drag gesture to increment/decrement the number value. Holding SHIFT while dragging will increase the value by the shiftStep.
maxnumberThe maximum value length.
minnumberMinimum value length.
requiredbooleanIf true enforces a valid number within the control’s min/max range. If false allows an empty string as a valid value.
shiftStepnumberAmount to increment by when the SHIFT key is held down. This shift value is a multiplier to the step value. For example, if the step value is 5, and shiftStep is 10, each jump would increment/decrement by 50.
stepnumberAmount by which the value is changed when incrementing/decrementing. It is also a factor in validation as value must be a multiple of step (offset by min, if specified) to be valid. Accepts the special string value any that voids the validation constraint and causes stepping actions to increment/decrement by 1.

radio

Renders a set of radio inputs.

{
  "type": "radio",
  "options": [
    {
      "value": "option1",
      "label": "Option 1"
    },
    {
      "value": "option2",
      "label": "Option 2"
    }
  ]
}

Properties

PropertyTypeDescription
defaultstring | numberDefault value that should be applied when first adding the block.
fallbackstring | numberFallback value that that will display when field value is empty.
optionsarrayOptions to choose from.
returnFormatstringSpecifies the return format value.
populateobject

range

Renders a range input to set a numerical value between two points.

{
  "type": "range",
  "min": 0,
  "max": 100,
  "step": 1
}

Properties

PropertyTypeDescription
defaultnumberDefault value that should be applied when first adding the block.
fallbacknumberFallback value that that will display when field value is empty.
allowResetbooleanIf this property is true, a button to reset the slider is rendered.
initialPositionnumberThe slider starting position, used when no value is passed. The initialPosition will be clamped between the provided min and max prop values.
isShiftStepEnabledbooleanIf true, enables mouse drag gesture to increment/decrement the number value. Holding SHIFT while dragging will increase the value by the shiftStep.
marksarrayRenders a visual representation of step ticks. Custom mark indicators can be provided by an Array.
maxnumberThe maximum value length.
minnumberMinimum value length.
railColorstringCSS color string to customize the rail element’s background.
resetFallbackValuenumberThe value to revert to if the Reset button is clicked (enabled by allowReset)
separatorTypestringDefine if separator line under/above control row should be disabled or full width. By default it is placed below excluding underline the control icon.
shiftStepnumberAmount to increment by when the SHIFT key is held down. This shift value is a multiplier to the step value. For example, if the step value is 5, and shiftStep is 10, each jump would increment/decrement by 50.
showTooltipbooleanForcing the Tooltip UI to show or hide. This is overridden to false when step is set to the special string value any.
stepnumberAmount by which the value is changed when incrementing/decrementing. It is also a factor in validation as value must be a multiple of step (offset by min, if specified) to be valid. Accepts the special string value any that voids the validation constraint and causes stepping actions to increment/decrement by 1.
trackColorstringCSS color string to customize the track element’s background.
withInputFieldbooleanDetermines if the input number field will render next to the RangeControl. This is overridden to false when step is set to the special string value any.

select

Renders a select input with support for single or multiple selections.

{
  "type": "select",
  "options": [
    {
      "value": "option1",
      "label": "Option 1"
    },
    {
      "value": "option2",
      "label": "Option 2"
    }
  ],
  "multiple": false
}

Properties

PropertyTypeDescription
defaultarray | string | numberDefault value that should be applied when first adding the block.
fallbackarray | string | numberFallback value that that will display when field value is empty.
multiplebooleanIf true, multiple options can be selected. "stylisedUi" will be automatically enabled.
optionsarrayOptions to choose from.
returnFormatstringSpecifies the return format value.
populateobject
stylisedUibooleanRenders a stylised version of a select with the ability to search through items.
allowNullboolean | stringAllows the user to select an empty choice. If true, the label will be empty, otherwise the option will render the specified string.
allowResetbooleanIf this property is true, a button to reset the select is rendered.

tabs

Renders a tabbed interface for grouping fields.

{
  "type": "tabs"
}

Properties

PropertyTypeDescription
tabsarrayThe tabs to display.

text

Renders a single line text input.

{
  "type": "text",
  "min": 0,
  "max": 100
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
maxnumberThe maximum value length.
minnumberMinimum value length.

textarea

Renders a textarea input.

{
  "type": "textarea",
  "min": 0,
  "max": 100,
  "rows": 4
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
maxnumberThe maximum value length.
minnumberMinimum value length.
rowsnumberThe number of rows the textarea should contain.

toggle

Renders a true/false toggle.

{
  "type": "toggle"
}

Properties

PropertyTypeDescription
defaultbooleanDefault value that should be applied when first adding the block.
fallbackbooleanFallback value that that will display when field value is empty.

repeater

Renders a set of fields that can be repeated.

{
  "type": "repeater",
  "min": 0,
  "max": 100
}

Properties

PropertyTypeDescription
minnumberMinimum amount of rows.
maxnumberMaximum amount of rows.
textButtonstringText for the add button.
textMinimizedstring | objectText that will be displayed when rows are minimized.
textRemovestring | booleanText to display in alert when removing repeater row.
attributesarrayAccepts all other field types besides another tabs.

richtext

Attribute field for RichText fields.

{
  "type": "richtext"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.

unit

Renders a number input with a unit dropdown.

{
  "type": "unit"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
disableUnitsbooleanIf true, the unit select field is hidden.
isPressEnterToChangebooleanIf true, the ENTER key press is required in order to trigger an onChange. If enabled, a change is also triggered when tabbing away.
isResetValueOnUnitChangebooleanIf true, and the selected unit provides a default value, this value is set when changing units.
isUnitSelectTabbablebooleanDetermines if the unit select field is tabbable.
unitsarray

wysiwyg

Renders a WYSIWYG editor.

{
  "type": "wysiwyg"
}

Properties

PropertyTypeDescription
defaultstringDefault value that should be applied when first adding the block.
fallbackstringFallback value that that will display when field value is empty.
toolbarobjectThe toolbar configuration for the editor.

On this page