Skip to content

co-date-field

This content is not available in your language yet.

Permite escribir la fecha a mano y mantiene el borrador (texto crudo) separado del valor confirmado, de modo que un padre controlado nunca pisa lo que el usuario teclea. El texto visible se formatea según display-format (por defecto d MMM yyyy, es-CO). Controla la tecla Enter para validar la fecha en lugar de enviar el formulario. Es la base de co-date-picker.

Ver código
<co-date-field label="Fecha" value="2026-06-03" helper-text="Formato dd/MM/yyyy"></co-date-field>

Props

PropAtributoTipoDefaultDescripción
clearLabelclear-labelstring | undefinedOverride the clear-button aria-label (defaults from `locale`).
clearableclearablebooleantrue
disableddisabledbooleanfalse
disabledDatesdisabled-datesstring | string[] | undefinedBlocked dates (string[] or JSON/comma string).
disabledDaysOfWeekdisabled-days-of-weeknumber[] | string | undefinedBlocked weekdays 0=Sun..6=Sat (number[] or JSON/comma string).
displayFormatdisplay-formatstring'd MMM yyyy'Display pattern (tokens yyyy/yy/MMMM/MMM/MM/M/dd/d).
errorMessageerror-messagestring | undefinedMessage shown when invalid.
helperTexthelper-textstring | undefinedHelper text shown when valid.
invalidinvalidbooleanfalseExternal invalid flag (e.g. from a form controller). OR'd with internal parse failure.
labellabelstring | undefined
layoutlayout"horizontal" | "vertical"'vertical'Label layout: vertical (label above) or horizontal (label beside)
localelocalestring'es-CO'BCP-47 locale.
maxmaxstring | undefinedLatest allowed date, "YYYY-MM-DD".
minminstring | undefinedEarliest allowed date, "YYYY-MM-DD".
namenamestring | undefined
placeholderplaceholderstring | undefined
readonlyreadonlybooleanfalse
requiredrequiredbooleanfalse
sizesize"lg" | "md" | "s" | "sm"'md'Field size (mirrors co-input): s 28 / sm 32 / md 40 / lg 48.
valuevaluenull | stringnullCommitted value, "YYYY-MM-DD" or null.

Eventos

EventoDetailBubblesCancelableDescripción
coBlurvoid
coChangenull | stringEmitted when a valid value (or null) is committed.
coClearvoidEmitted when cleared.
coFocusvoid
coInputstringEmitted on every keystroke with the raw text.
coInvalid{ raw: string; }Emitted when a committed parse fails. Detail carries the raw text.

Slots

Este componente no expone slots.

CSS Parts

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

CSS Custom Properties

Este componente no expone CSS custom properties.