Skip to content

co-json-field

This content is not available in your language yet.

Editor de JSON u objeto arbitrario sobre un <textarea> con validación de parseo en línea. Es el renderer de los campos de esquema de tipo mixed. El value comprometido es el texto JSON crudo (string), que el formulario consumidor se encarga de parsear.

Ver código
<co-json-field label="Metadata" placeholder="{ }" rows="8" helper-text="Debe ser JSON válido"></co-json-field>

Props

PropAtributoTipoDefaultDescripción
disableddisabledbooleanfalse
helperTexthelper-textstring | undefinedHelper text shown below the field.
invalidMessageinvalid-messagestring'Invalid JSON'Message shown when the typed JSON cannot be parsed.
labellabelstring | undefined
layoutlayout"horizontal" | "vertical"'vertical'Label layout: vertical (label above) or horizontal (label beside)
namenamestring | undefined
placeholderplaceholderstring'{ }'
readonlyreadonlybooleanfalse
requiredrequiredbooleanfalse
rowsrowsnumber8
sizesize"lg" | "md" | "s" | "sm"'md'Field size (mirrors co-input paddings; mono font scales 12/13/13/14). Vertical extent still comes from `rows`.
statusstatus"default" | "error" | "success" | "warning"'default'External validation status (e.g. from a form controller).
valuevaluestring''Committed JSON text.

Eventos

EventoDetailBubblesCancelableDescripción
coBlurvoid
coChangestringEmitted with the committed text on blur.
coFocusvoid
coInputstringEmitted on every keystroke with the raw text.
coValidity{ valid: boolean; message?: string | undefined; }Emitted whenever the internal JSON parse status changes.

Slots

Este componente no expone slots.

CSS Parts

PartDescripción
::part(field)The bordered textarea wrapper
::part(helper)The helper/error text row
::part(input)The native textarea
::part(label)The field label
::part(wrapper)Root container

CSS Custom Properties

Este componente no expone CSS custom properties.