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

Calendar

Single/range APG day grid with native day and caption controls.

All components · Theme builder · Implementation source

Live preview

Open live calendar preview

Install

Shell
netscript ui:add calendar

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 { Calendar } from '@app/components/ui/calendar.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><Calendar aria-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
CalendarPropsmode"single" | "range"Yes
CalendarPropsmonths1 | 2Yes
CalendarPropscaption"label" | "dropdown"Yes
CalendarPropsvalue[object Object]Yes
CalendarPropsdefaultValue[object Object]Yes
CalendarPropsdefaultMonthstringYes
CalendarPropstodaystringYes
CalendarPropsonValueChange(dates: [object Object]) => voidYes
CalendarPropsminstringYes
CalendarPropsmaxstringYes
CalendarPropsdisabledbooleanYes
CalendarPropsisDateDisabled(date: string) => booleanYes
CalendarPropsweekStartsOn0 | 1Yes
CalendarPropslocalestringYes
CalendarPropsautoFocusbooleanYes
CalendarPropsclassstringYes
TypeScript
CalendarProps extends Omit<JSX.HTMLAttributes<HTMLDivElement>, "class" | "onChange">

Keyboard

KeyAction
Arrow keysMove between cells
Home/EndMove to first/last cell
PageUp/PageDownMove one month, preserving or clamping the day; Shift moves one year.
Enter/SpaceSelect the focused enabled day.

Tokens

Semantic contract roles: primary/default, primary/fg, radius/input, surface/muted, surface/selected, text/fg, text/muted.

CSS custom properties referenced directly: --ns-border-width, --ns-card, --ns-control-gap, --ns-control-height-sm, --ns-fg, --ns-hover, --ns-input-border, --ns-muted, --ns-muted-fg, --ns-primary, --ns-primary-fg, --ns-primary-hover, --ns-radius-control, --ns-radius-input, --ns-ring, --ns-selected, --ns-space-2, --ns-space-4, --ns-text-caption, --ns-text-small, --ns-text-strong, --ns-weight-strong.

Contract and compatibility

Accessibility pattern: WAI-ARIA guidance

  • UTC Gregorian ISO API; native buttons and select captions. Day state/range are derived, with CSS hover/focus; no caller state simulation. Only endpoints get selected visual state; middle cells remain aria-selected with range fill.
  • Hydrate inside an island. Disabled/out-of-bounds dates are skipped; browsing alone never changes selection.

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.