MonthPicker

View Source

NOTE: Introduced feature in v0.4.10.

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

MonthPicker is a Widget that displays a fiscal quaterly grid of months that a user can select from.

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

    const timestamp = "2021-01-01";
    const value = ["2021-06-01"];
</script>

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

Imports

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

Disabled

You can disable all interactivity via the disabled property.

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

    const timestamp = "2021-01-01";
</script>

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

Disabled Months

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

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

    const timestamp = "2021-01-01";

    const disabled = ["2021-06-01", "2021-12-01"];
</script>

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

Multiple

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

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

    const timestamp = "2021-01-01";
    const value = ["2021-06-01", "2021-12-01"];
</script>

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

Once

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

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

    const timestamp = "2021-01-01";
    const value = ["2021-06-01"];
</script>

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

Readonly

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

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

    const timestamp = "2021-01-01";
</script>

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

Highlight

NOTE: By default, the current month is used.

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

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

    const timestamp = "2021-01-01";

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

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

Maximum + Minimum

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

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

    const timestamp = "2021-01-01";

    const max = "2021-07-01";
    const min = "2021-05-01";
</script>

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

Custom Format

You can customize how the month component of the available timestamps is displayed via the month property.

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

    const timestamp = "2021-01-01";
</script>

<MonthPicker
    palette="accent"
    month="long"
    width="content-max"
    {timestamp}
/>

Sizing

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

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

    const timestamp = "2021-01-01";
</script>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Properties

MonthPicker

Name Description Types
value Sets the selected month ISO 8601 / RFC 3339 timestamps.
string[]
disabled Disables all months from being selected, or given ISO 8601 / RFC 3339 timestamps from being selected.
boolean string[]
readonly Disables toggling on of unselected months.
boolean
multiple Enables selection of multiple months.
boolean
once Disables toggling off of already selected months.
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 month timestamp ISO 8601 / RFC 3339 in the future that can be selected.
string
min Sets the minimum month 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 MonthPicker.
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
month Alters how a displayed month is formatted.
2-digit long narrow numeric short

Events

MonthPicker

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