dssoca docs
GitHub repository

DateField

Styled native date input.

A styled wrapper around the native `<input type="date">`, sharing the field chrome of `Input`: label association, focus ring on the wrapper, hint/error messaging wired through `aria-describedby`, and invalid/disabled/readonly states. Bind an ISO `yyyy-mm-dd` string via `value` and constrain the range with `min`/`max`. The calendar picker glyph is tuned to read on the dark theme; zero border-radius.

Demo

live · storybook Open in Storybook

Demo loads from https://dssoca-storybook.vercel.app/. Run pnpm storybook for it to render locally.

Usage

svelte
<script>
  import { DateField } from 'dssoca';
  let date = $state('2026-06-15');
</script>

<DateField label="Start date" bind:value={date} />
<DateField label="Booking" bind:value={date} min="2026-06-01" max="2026-06-30" />

Props

PropTypeDefaultDescription
labelstringLabel text; rendered and associated to the input.
idstringInput id; auto-generated for label association when unset.
namestringNative form field name.
valuestring''Bindable ISO date string (yyyy-mm-dd).
minstringEarliest selectable date (ISO yyyy-mm-dd).
maxstringLatest selectable date (ISO yyyy-mm-dd).
requiredbooleanfalseMarks the field as required for form validation.
disabledbooleanfalseRenders the field non-interactive.
readonlybooleanfalseNative readonly — value visible but not editable; rendered muted.
invalidbooleanMarks the field invalid for assistive tech (aria-invalid).
hintstringHelper text under the field, wired via aria-describedby.
errorstringError text under the field; implies aria-invalid and is announced via role="alert".
describedbystringExtra id(s) appended to aria-describedby after error/hint.
onchange(e: Event) => voidNative change handler (fired when the committed date changes).
oninput(e: Event) => voidNative input handler.
size'sm' | 'md' | 'lg'Per-instance size override; inherits the ancestor `data-size-variant` when unset.