Skip to main content

Calendar

Shared, editable XML components from the calendar family.

Usage​

Declare the catalog namespace in your screen and run relo-components build to bundle its dependencies before delivery. Install Components host support before session creation. Use ui:Theme or your compatible theme.

<ui:Theme xmlns:ui="urn:relo:registry:relo">
<ui:Calendar bind-page="data.page" />
</ui:Theme>

Supply the required data fields with the shape expected by the component. This invocation shows the input boundary; see the editable definition for composition and service requirements.

Dependencies: button, theme.

Exports​

ui:Calendar · ui:CalendarDayButton

ui:Calendar​

PropDefaultRequired
page—Yes
valuenullNo
locale'en_US'No
weekStart0No
mode'single'No
todaynullNo
minnullNo
maxnullNo

Template signatures declare names and defaults, not static types. Values must satisfy the underlying primitive or service. Defaults preserve the exact source expression; the definition below shows how inputs are used. Use literal strings or bind-* for evaluated values. Unknown inputs and missing required props fail validation.

Events​

  • on-change — explicitly emitted output; inspect the definition for payload shape.

Slots​

No content outlets.

Definition and forwarded payloads
<Component name="Calendar" props="page, value=null, locale='en_US', weekStart=0, mode='single', today=null, min=null, max=null" xmlns:ui="urn:relo:registry:relo">
<Column state="{monthPage:props.page}" bind-key="props.page.month ?? 'initial'" class="p-2 gap-2">
<Row class="items-center justify-between">
<ui:Button label="Previous month" bind-enabled="monthPage.canPrevious ?? true" variant="ghost" size="icon" on-press="call uiCalendar.page with {month:monthPage.previousMonth, locale:props.locale, weekStart:props.weekStart, today:props.today, min:props.min, max:props.max} into result; set monthPage to result">
<ui:IconChevronLeft class="w-4 h-4" />
</ui:Button>
<Text bind-text="monthPage.title" class="font-rc-small font-medium" maxLines="1" />
<ui:Button label="Next month" bind-enabled="monthPage.canNext ?? true" variant="ghost" size="icon" on-press="call uiCalendar.page with {month:monthPage.nextMonth, locale:props.locale, weekStart:props.weekStart, today:props.today, min:props.min, max:props.max} into result; set monthPage to result">
<ui:IconChevronRight class="w-4 h-4" />
</ui:Button>
</Row>
<Grid columns="7" gap="0">
<For each="weekday" in="monthPage.weekdays" key="weekday.id">
<Text bind-text="weekday.label" class="font-rc-small text-center text-rc-muted-foreground" maxLines="1" />
</For>
</Grid>
<SelectionGroup bind-value="null" mode="focus" orientation="grid" columns="7" activation="manual" on-activate="call uiSelection.change with {value:props.value,item:event.value,mode:props.mode} into result; emit change with {value:result}">
<Grid columns="7" gap="0">
<For each="day" in="monthPage.days" key="day.id">
<Pressable bind-label="day.label" bind-itemValue="day.date" bind-selected="(props.mode == 'single' and props.value == day.date) or (props.mode == 'multiple' and day.date in props.value) or (props.mode == 'range' and props.value != null and props.value.start != null and day.date &gt;= props.value.start and day.date &lt;= (props.value['end'] ?? props.value.start))" bind-enabled="not day.disabled" class="transition spring-fast rc-item p-1">
<Row class="h-full flex-1 items-center justify-center">
<Text if="not day.outside" bind-text="day.text" class="font-rc-small text-center" maxLines="1" />
<Text if="day.outside" bind-text="day.text" class="font-rc-small text-center text-rc-muted-foreground" maxLines="1" />
</Row>
</Pressable>
</For>
</Grid>
</SelectionGroup>
</Column>
</Component>

Read Calendar source.

ui:CalendarDayButton​

PropDefaultRequired
value''No
label''No
selectedfalseNo
enabledtrueNo

Template signatures declare names and defaults, not static types. Values must satisfy the underlying primitive or service. Defaults preserve the exact source expression; the definition below shows how inputs are used. Use literal strings or bind-* for evaluated values. Unknown inputs and missing required props fail validation.

Events​

  • on-selected — explicitly emitted output; inspect the definition for payload shape.

Slots​

No content outlets.

Definition and forwarded payloads
<Component name="CalendarDayButton" props="value='', label='', selected=false, enabled=true">
<Pressable bind-label="props.label" bind-selected="props.selected" bind-enabled="props.enabled" class="transition spring-fast rc-item h-8 w-8" on-press="emit selected with {value:props.value}">
<Row class="h-full flex-1 items-center justify-center">
<Text bind-text="props.label" class="font-rc-small text-center" maxLines="1" />
</Row>
</Pressable>
</Component>

Read CalendarDayButton source.

Composition and accessibility​

Use explicit value/change ownership; events do not bubble automatically. A component forwards only outputs declared by its own emits. Slots retain caller scope. Supply meaningful labels for interactive controls, preserve focus and touch targets, and test reduced motion on each platform.

Component customization · Definitions and slots · Components index