Skip to content

Texte & médias

Contrôles basés sur string (et object pour le WYSIWYG).


String — UInput

Activation : type: "string" (sans multi, sans format spécial).

API

NameTypeDefaultDescription
restrictBooleanApplique schema.maxLength et affiche un compteur de caractères.
inputObjectPass-through → UInput (size, color, ui, …).

Les options communes (placeholder, focus, …) s’appliquent aussi.

Exemples

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

Schéma associé pour restrict :

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

Textarea — UTextarea

Activation : options.multi: true.

API

NameTypeDefaultDescription
multiBooleanRequis pour activer le renderer textarea.
rowsNumber30Hauteur maximale (autoresize).
minRowsNumberNombre de lignes initial / minimum.
textareaObjectPass-through → UTextarea.

Exemples

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

Password

Activation : schema format: "password".

Mêmes options que String (placeholder, input, …). Le bouton d’affichage / masquage est intégré.

Exemple

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

Pin — UPinInput

Activation : options.format: "pin".

API

NameTypeDefaultDescription
format"pin"Requis pour sélectionner ce renderer.
lengthNumberinféré (maxLength / pattern)Nombre de cellules.
type"text" | "number"inféréType de clavier / saisie.
maskBooleanMasque les caractères saisis.
otpBooleanActive l’autocomplete SMS OTP.
pinInputObjectPass-through → UPinInput.

Exemples

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

Activation : schema format: "color" ou options.format: "color".

API

NameTypeDefaultDescription
format"color"Force le color picker si le schema n’a pas format: "color".
colorFormat"hex" | "rgb" | "hsl" | "cmyk" | "lab""hex"Notation émise dans les données.
showInputBooleantrueAffiche le champ texte à côté du picker. false = picker seul.
colorPickerObjectPass-through → UColorPicker.
inputObjectPass-through → le UInput hex/texte.

Exemples

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

Activation : schema format: "data-url" ou options.format: "file".
Multi-fichiers : schema type: "array" d’items string.

API

NameTypeDefaultDescription
format"file"Force l’upload (utile pour un array sans format: data-url).
acceptStringcontentMediaType du schemaFiltre MIME (image/*, application/pdf, …).
dropLabelStringTitre de la zone de dépôt.
dropDescriptionStringSous-texte de la zone.
layoutString"list"Layout Nuxt UI ("list", "grid", …).
fileUploadObjectPass-through → UFileUpload.

Exemples

json
{
  "type": "Control",
  "scope": "#/properties/cv",
  "options": {
    "accept": "application/pdf",
    "dropLabel": "Déposez votre CV"
  }
}
json
{
  "type": "Control",
  "scope": "#/properties/photos",
  "options": {
    "format": "file",
    "dropLabel": "Déposez des images",
    "layout": "grid"
  }
}

Autocomplete API — UInputMenu

Activation : présence de options.api.

API

NameTypeDefaultDescription
apiObjectRequis. Configuration du fetch distant (voir ci-dessous).
minLengthNumber(interne)Nombre minimum de caractères avant la requête.
suggestionString[]Suggestions locales de secours.
placeholderStringPlaceholder du champ.
inputMenuObjectPass-through → UInputMenu.

Objet api

NameTypeDefaultDescription
urlStringRequis. Chemin ou URL de l’endpoint.
baseStringPréfixe d’origine (ex. https://api.example.com).
queryKeyString"q"Nom du paramètre de recherche.
paramsObjectParamètres de query fixes.
headersObjectEn-têtes HTTP.
itemsPathStringChemin (dot) vers le tableau dans la réponse JSON.
labelKeyString"label"Chemin vers le libellé d’un item.
valueKeyString"value"Chemin vers la valeur stockée.

Exemple

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

WYSIWYG — UEditor

Activation : options.wysiwyg: true sur un contrôle object (ou string selon contentType).
Nécessite allRenderers (pas seulement nuxtUiRenderers).

API

NameTypeDefaultDescription
wysiwygBooleanRequis (true) pour activer l’éditeur.
contentType"json" | "html"inféréFormat stocké : objet ProseMirror (json) ou chaîne HTML (html).
toolbarArraytoolbar Nuxt UIRemplace la barre d’outils (EditorToolbarItem[]).
placeholderStringPlaceholder de l’éditeur.
editorObjectPass-through → UEditor.

Exemples

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

Playground

Publié sous licence BSD-3-Clause.