Skip to main content
NetScriptdocs Search docs ⌘K v0.0.9
Browse documentation

DatePicker

Native modal calendar picker with focus restoration and ISO form values.

All components · Theme builder · Implementation source

Live preview

Open live date-picker preview

Install

Shell
netscript ui:add date-picker

Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

TypeScript
import { useState } from 'preact/hooks';
import { DatePicker } from '@app/components/ui/date-picker.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><DatePicker label="Delivery date" defaultMonth="2026-11-01" /></div><p role="status">{notice}</p></>);
}

Props

Generated from native deno doc --json --private over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

OwnerPropTypeOptionalDescription
DatePickerPropslabelstringNo
DatePickerPropsnamestringYes
DatePickerPropsmode"single" | "range"Yes
DatePickerPropsvalue[object Object]Yes
DatePickerPropsdefaultValue[object Object]Yes
DatePickerPropsonValueChange(dates: [object Object]) => voidYes
DatePickerPropsopenbooleanYes
DatePickerPropsdefaultOpenbooleanYes
DatePickerPropsonOpenChange(open: boolean) => voidYes
DatePickerPropsdefaultMonthstringYes
DatePickerPropsminstringYes
DatePickerPropsmaxstringYes
DatePickerPropsdisabledbooleanYes
DatePickerPropsstate"rest" | "focus" | "disabled" | "invalid"Yes
DatePickerPropsplaceholderstringYes
DatePickerPropslocalestringYes
DatePickerPropsclassstringYes
TypeScript
DatePickerProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "onChange">

Keyboard

KeyAction
Tab/Shift+TabCycle focus within modal
EscapeDismiss and restore trigger focus

Tokens

Semantic contract roles: surface/card, text/fg.

CSS custom properties referenced directly: --ns-border, --ns-border-width, --ns-card, --ns-control-gap, --ns-control-height, --ns-control-height-sm, --ns-control-padding-x, --ns-destructive, --ns-fg, --ns-floating-anchor-name, --ns-input-border, --ns-radius-card, --ns-radius-control, --ns-radius-input, --ns-ring, --ns-space-2, --ns-space-4, --ns-surface-raised, --ns-text-small.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • Calendar embedded in package-owned native modal Dialog; uses existing focus, Escape and return behavior.
  • Browser-forced dismissal can supersede a rejected close request; applications should normally accept native close requests.
  • ISO value collection and open state can each be controlled. A named hidden input submits dates joined by /. Open data-state is derived; hydrate in an island.

Design contract values marked planned are not implementation props. The props above describe what ships today.

Search all documentation

Type a term to search the documentation.