DayPicker

View Source

NOTE: Introduced feature in v0.4.10.

WARNING: This feature received a breaking change in v0.6.0.

DayPicker is a Widget that displays a calendar-style grid of days that a user can select from.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
    const value = ["2021-11-05"];
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {timestamp}
    {value}
/>

Imports

<script>
    import {DayPicker} from "@kahi-ui/framework";
</script>

Disabled

You can disable all interactivity via the disabled property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {timestamp}
    disabled
/>

Disabled Days

You can disable specific days from being selected via the disabled property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";

    const disabled = ["2021-11-05", "2021-11-19"];
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {disabled}
    {timestamp}
/>

Multiple

You can allow for multiple days to be selected via the multiple property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
    const value = ["2021-11-05", "2021-11-19"];
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {timestamp}
    {value}
    multiple
/>

Once

You can disable selected days from being unselected via the once property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
    const value = ["2021-11-05"];
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {timestamp}
    {value}
    once
/>

Readonly

You can disable interactivity without changing the visuals via the readonly property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {timestamp}
    readonly
/>

Highlight

NOTE: By default, the current day is used.

You can select a specific set of days to be highlighted as outlines via the highlight property.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";

    const highlight = [
        "2021-11-11",
        "2021-11-12",
        "2021-11-13",
    ];
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {highlight}
    {timestamp}
/>

Maximum + Minimum

You can set maximum and minimum range of selectable days via the max / min properties.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";

    const max = "2021-11-19";
    const min = "2021-11-05";
</script>

<DayPicker
    palette="accent"
    width="content-max"
    {max}
    {min}
    {timestamp}
/>

Custom Format

You can customize how the day component of the available timestamps is displayed via the day and weekday properties respectively.

<script>
    import {DayPicker} from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
</script>

<DayPicker
    palette="accent"
    day="numeric"
    weekday="long"
    width="content-max"
    {timestamp}
/>

Sizing

You can alter the overall spacing / sizing look and feel via the sizing property.

<script>
    import {
        DayPicker,
        Stack,
        Text,
    } from "@kahi-ui/framework";

    const timestamp = "2021-11-10";
</script>

<Stack.Container
    orientation="horizontal"
    spacing="medium"
    alignment_y="top"
    variation="wrap"
>
    <div>
        <Text is="strong">DEFAULT</Text>

        <DayPicker
            palette="accent"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">NANO</Text>

        <DayPicker
            palette="accent"
            sizing="nano"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">TINY</Text>

        <DayPicker
            palette="accent"
            sizing="tiny"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">SMALL</Text>

        <DayPicker
            palette="accent"
            sizing="small"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">MEDIUM</Text>

        <DayPicker
            palette="accent"
            sizing="medium"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">LARGE</Text>

        <DayPicker
            palette="accent"
            sizing="large"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">HUGE</Text>

        <DayPicker
            palette="accent"
            sizing="huge"
            width="content-max"
            {timestamp}
        />
    </div>

    <div>
        <Text is="strong">MASSIVE</Text>

        <DayPicker
            palette="accent"
            sizing="massive"
            width="content-max"
            {timestamp}
        />
    </div>
</Stack.Container>

Properties

DayPicker

Name Description Types
value Sets the selected day ISO 8601 / RFC 3339 timestamps.
string[]
disabled Disables all days from being selected, or given ISO 8601 / RFC 3339 timestamps from being selected.
boolean string[]
readonly Disables toggling on of unselected days.
boolean
multiple Enables selection of multiple days.
boolean
once Disables toggling off of already selected days.
boolean
highlight Highlights the given ISO 8601 / RFC 3339 timestamps as outlined.
string[]
timestamp Sets the ISO 8601 / RFC 3339 timestamp of the calendar being listed.
string
max Sets the maximum day timestamp ISO 8601 / RFC 3339 in the future that can be selected.
string
min Sets the minimum day timestamp ISO 8601 / RFC 3339 in the past that can be selected.
string
palette Alters the displayed color scheme.
auto inverse inherit accent neutral off dark light alert affirmative informative negative
sizing Sets the size of children / spacing relative to the font size of the DayPicker.
nano tiny small medium large huge massive {VIEWPORT}:{SIZING}
locale Alters the locale used for displaying internationalized text via RFC 5646 / BCP 47 language tags.
string
day Alters how a displayed day is formatted.
2-digit numeric
weekday Alters how a displayed weekday is formatted.
long narrow short

Events

DayPicker

Name Description Types
change Fires whenever the value property changes.
CustomEvent<void>