DatePickerAdvanced
Inline calendar with optional date summary rows, time pickers, and toggles. Month and year grids keep a stable height; use Back in the header to return to the day grid.
import { DatePickerAdvanced } from "phoundry-ui";Notion-style toggles
Loading interactive example…
View source
<script lang="ts"> import { DatePickerAdvanced, type DatePickerAdvancedValue, } from "phoundry-ui";
let dateValue = $state<DatePickerAdvancedValue>({ startDate: null, endDate: null, includeTime: false, includeEndDate: false, });
function formatDateTime(d: Date | null): string { if (!d) return "none"; return d.toLocaleString(); }</script>
<p class="mb-2 text-xs text-txt-tertiary"> End date, include time, and clear - controlled via bindable value. Week starts on Monday.</p><DatePickerAdvanced bind:value={dateValue} weekStartsOn={1} /><p class="mt-2 text-xs text-txt-tertiary"> Date: {formatDateTime(dateValue.startDate)} {#if dateValue.includeEndDate && dateValue.endDate} → {formatDateTime(dateValue.endDate)} {/if}</p>Compact calendar (no toggles)
Loading interactive example…
View source
<script lang="ts"> import { DatePickerAdvanced, type DatePickerAdvancedValue, } from "phoundry-ui";
let compactValue = $state<DatePickerAdvancedValue>({ startDate: new Date(2026, 4, 10), endDate: null, includeTime: false, includeEndDate: false, });
const advMin = new Date(2026, 4, 1);
const advMax = new Date(2026, 4, 28);</script>
<p class="mb-2 text-xs text-txt-secondary"> Matches the internal panel used by <code>DatePicker</code> - only the grid + navigation chrome.</p><DatePickerAdvanced bind:value={compactValue} showToggles={false} minDate={advMin} maxDate={advMax}/>Disabled
Loading interactive example…
View source
<script lang="ts"> import { DatePickerAdvanced, type DatePickerAdvancedValue, } from "phoundry-ui";
let disabledDemo = $state<DatePickerAdvancedValue>({ startDate: new Date(2026, 4, 15), endDate: null, includeTime: false, includeEndDate: false, });</script>
<DatePickerAdvanced bind:value={disabledDemo} disabled />DatePickerAdvanced props
From phoundry-ui@0.4.21
| Name | Type | Default | Description |
|---|---|---|---|
valuebindable | DatePickerAdvancedValue | {
startDate: null,
endDate: null,
includeTime: false,
includeEndDate: false
} | Bindable structured value (start/end, include toggles). |
onchange | (type: DatePickerChangeType, value: DatePickerAdvancedValue) => void | — | Optional lifecycle hook - useful for analytics; state still updates via bind:value. |
formatDate | (date: Date) => string | — | Optional formatter for selected dates shown in the summary rows. |
minDate | Date | — | Earliest selectable date. |
maxDate | Date | — | Latest selectable date. |
disabled | boolean | false | Disable the picker. |
weekStartsOn | 0 | 1 | 0 | First day of week: 0 = Sunday, 1 = Monday. |
showToggles | boolean | true | Show date rows + Notion-style toggles (End date, Include time, Clear). |
class | ClassValue | — | Additional CSS classes. |
Usage tips
- Use
minDateandmaxDateto constrain selectable dates. - In
rangemode (whenincludeEndDateis true), the first click sets the start and the second click sets the end. - Use
DatePickerAdvancedwithshowToggles={false}for a compact calendar (same layoutDatePickeruses internally). - Set
weekStartsOn={1}for Monday-first calendars (ISO standard). - Use
formatDatewhen the picker summary rows need to match a host application’s date presentation.
CSS styling
.ph-date-picker-advanced is the stable identification hook for DatePickerAdvanced. Part selectors and --_ph-* properties are internal. Component CSS is scoped and unlayered; Consumer classes remain additive and utility overrides may lose precedence.
Calendar selection uses aria-pressed and separate range-state attributes. Day, month, year, time, and range behavior remain available.
Keep the shared component stylesheet and a named Theme imported. Decorative motion respects reduced-motion preferences.