Skip to content

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
notion-style-toggles.svelte
<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
compact-calendar-no-toggles.svelte
<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
disabled.svelte
<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

NameTypeDefaultDescription
valuebindableDatePickerAdvancedValue{ 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.
minDateDate—Earliest selectable date.
maxDateDate—Latest selectable date.
disabledbooleanfalseDisable the picker.
weekStartsOn0 | 10First day of week: 0 = Sunday, 1 = Monday.
showTogglesbooleantrueShow date rows + Notion-style toggles (End date, Include time, Clear).
classClassValue—Additional CSS classes.

Usage tips

  • Use minDate and maxDate to constrain selectable dates.
  • In range mode (when includeEndDate is true), the first click sets the start and the second click sets the end.
  • Use DatePickerAdvanced with showToggles={false} for a compact calendar (same layout DatePicker uses internally).
  • Set weekStartsOn={1} for Monday-first calendars (ISO standard).
  • Use formatDate when 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.

Documentation is licensed under CC BY 4.0. Phoundry names and marks remain reserved.