Skip to content

Text & media

Controls based on string (and object for the WYSIWYG editor).


String — UInput

Trigger: type: "string" (no multi, no special format).

API

NameTypeDefaultDescription
restrictBooleanEnforces schema.maxLength and shows a character counter.
inputObjectPass-through → UInput (size, color, ui, …).

The common options (placeholder, focus, …) apply as well.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/name",
  "options": {
    "placeholder": "Camille Dupont",
    "input": { "size": "lg" }
  }
}
json
{
  "type": "Control",
  "scope": "#/properties/slug",
  "options": { "restrict": true }
}

Matching schema for restrict:

json
{
  "type": "string",
  "maxLength": 32,
  "title": "Slug"
}

Textarea — UTextarea

Trigger: options.multi: true.

API

NameTypeDefaultDescription
multiBooleanRequired to enable the textarea renderer.
rowsNumber30Maximum height (autoresize).
minRowsNumberInitial / minimum number of rows.
textareaObjectPass-through → UTextarea.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/description",
  "options": {
    "multi": true,
    "minRows": 3,
    "rows": 12,
    "placeholder": "Long description…"
  }
}

Password

Trigger: schema format: "password".

Same options as String (placeholder, input, …). The show / hide button is built in.

Example

json
{
  "type": "string",
  "format": "password",
  "title": "Password"
}
json
{
  "type": "Control",
  "scope": "#/properties/password",
  "options": { "placeholder": "••••••••" }
}

Pin — UPinInput

Trigger: options.format: "pin".

API

NameTypeDefaultDescription
format"pin"Required to select this renderer.
lengthNumberinferred (maxLength / pattern)Number of cells.
type"text" | "number"inferredKeyboard / input type.
maskBooleanMasks the typed characters.
otpBooleanEnables SMS OTP autocomplete.
pinInputObjectPass-through → UPinInput.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/code",
  "options": { "format": "pin", "otp": true }
}
json
{
  "type": "Control",
  "scope": "#/properties/secretCode",
  "options": { "format": "pin", "mask": true, "length": 6 }
}
json
{
  "type": "Control",
  "scope": "#/properties/token",
  "options": { "format": "pin", "length": 8, "type": "text" }
}

Color — UColorPicker

Trigger: schema format: "color" or options.format: "color".

API

NameTypeDefaultDescription
format"color"Forces the color picker when the schema has no format: "color".
colorFormat"hex" | "rgb" | "hsl" | "cmyk" | "lab""hex"Notation emitted in the data.
showInputBooleantrueShows the text field next to the picker. false = picker only.
colorPickerObjectPass-through → UColorPicker.
inputObjectPass-through → the hex/text UInput.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/brandColor",
  "options": { "format": "color", "colorFormat": "rgb" }
}
json
{
  "type": "Control",
  "scope": "#/properties/accent",
  "options": { "format": "color", "showInput": false }
}

File upload — UFileUpload

Trigger: schema format: "data-url" or options.format: "file".
Multi-file: schema type: "array" of string items.

API

NameTypeDefaultDescription
format"file"Forces the upload control (useful for an array without format: data-url).
acceptStringschema contentMediaTypeMIME filter (image/*, application/pdf, …).
dropLabelStringTitle of the drop zone.
dropDescriptionStringSub-text of the drop zone.
layoutString"list"Nuxt UI layout ("list", "grid", …).
fileUploadObjectPass-through → UFileUpload.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/cv",
  "options": {
    "accept": "application/pdf",
    "dropLabel": "Drop your résumé"
  }
}
json
{
  "type": "Control",
  "scope": "#/properties/photos",
  "options": {
    "format": "file",
    "dropLabel": "Drop images here",
    "layout": "grid"
  }
}

Autocomplete API — UInputMenu

Trigger: presence of options.api.

API

NameTypeDefaultDescription
apiObjectRequired. Remote fetch configuration (see below).
minLengthNumber(internal)Minimum number of characters before the request.
suggestionString[]Local fallback suggestions.
placeholderStringField placeholder.
inputMenuObjectPass-through → UInputMenu.

api object

NameTypeDefaultDescription
urlStringRequired. Endpoint path or URL.
baseStringOrigin prefix (e.g. https://api.example.com).
queryKeyString"q"Name of the search parameter.
paramsObjectFixed query parameters.
headersObjectHTTP headers.
itemsPathStringDot path to the array in the JSON response.
labelKeyString"label"Path to an item’s label.
valueKeyString"value"Path to the stored value.

Example

json
{
  "type": "Control",
  "scope": "#/properties/addressId",
  "options": {
    "placeholder": "Search for an address…",
    "minLength": 3,
    "api": {
      "base": "https://data.geopf.fr",
      "url": "/geocodage/search",
      "queryKey": "q",
      "itemsPath": "features",
      "labelKey": "properties.label",
      "valueKey": "properties.id"
    }
  }
}

WYSIWYG — UEditor

Trigger: options.wysiwyg: true on an object control (or string, depending on contentType).
Requires allRenderers (not just nuxtUiRenderers).

API

NameTypeDefaultDescription
wysiwygBooleanRequired (true) to enable the editor.
contentType"json" | "html"inferredStored format: ProseMirror object (json) or HTML string (html).
toolbarArrayNuxt UI toolbarReplaces the toolbar (EditorToolbarItem[]).
placeholderStringEditor placeholder.
editorObjectPass-through → UEditor.

Examples

json
{
  "type": "Control",
  "scope": "#/properties/body",
  "options": { "wysiwyg": true, "contentType": "json" }
}
json
{
  "type": "Control",
  "scope": "#/properties/notesHtml",
  "options": {
    "wysiwyg": true,
    "contentType": "html",
    "placeholder": "HTML input…"
  }
}

Playground

Released under the BSD-3-Clause License.