Zubra UI
Code for
GitHub

date-range

A check-in and check-out date, as one value { start, end } ("YYYY-MM-DD" strings). A form control: invalid until both are set and end is after start.

Try it: events appear here (valuechange).

Source: date-range.zb, and its registry item.

Install

Compiled (any project)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/date-range.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/date-range.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/date-range.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/date-range.json
One file, no dependencies (3.1 KB gzipped)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/date-range.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/date-range.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/date-range.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/element/date-range.json
.zb source (to edit it with Zubra)
npx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/date-range.jsonpnpm dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/date-range.jsonyarn dlx shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/date-range.jsonbunx --bun shadcn@latest add https://zubra-js.github.io/zubra-ui/r/src/date-range.json
No build: a script tag, straight from this site
HTML
<link rel="stylesheet" href="https://zubra-js.github.io/zubra-ui/themes/default.css">
<script type="module" src="https://zubra-js.github.io/zubra-ui/cdn/date-range.js"></script>

The compiled install writes src/components/zubra/date-range.js and the theme, and adds @zubra/runtime to your dependencies. The one-file install writes the same path as a plain custom element that needs nothing installed (or download it and load it with a <script type="module">); it's smaller on a page with one to three components, the shared runtime with more.

Usage

index.html
<date-range name="stay" min="2026-01-01"></date-range>

<script type="module">
  import './components/zubra/date-range.js';

  const element = document.querySelector('date-range');
  element.value = { start: '2026-12-18', end: '2026-12-22' };
  element.addEventListener('valuechange', (event) => console.log('valuechange', event.detail));
</script>
Example.jsx
import './components/zubra/date-range.js';

const value = { start: '2026-12-18', end: '2026-12-22' };

export function DateRangeExample() {
  return (
    <date-range
      name="stay"
      min="2026-01-01"
      value={value}
      onvaluechange={(event) => console.log('valuechange', event.detail)}
    ></date-range>
  );
}
Example.vue
<script setup>
import './components/zubra/date-range.js';
const value = { start: '2026-12-18', end: '2026-12-22' };
const onValuechange = (event) => console.log('valuechange', event.detail);
</script>

<template>
  <date-range
    name="stay"
    min="2026-01-01"
    :value.prop="value"
    @valuechange="onValuechange"
  ></date-range>
</template>

<!-- vite.config.js: vue({ template: { compilerOptions: { isCustomElement: (tag) => tag.includes('-') } } }) -->
Example.svelte
<script>
  import './components/zubra/date-range.js';
  const value = { start: '2026-12-18', end: '2026-12-22' };
</script>

<date-range
  name="stay"
  min="2026-01-01"
  {value}
  onvaluechange={(event) => console.log('valuechange', event.detail)}
></date-range>
example.component.ts
import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import './components/zubra/date-range.js';

@Component({
  selector: 'app-date-range-example',
  schemas: [CUSTOM_ELEMENTS_SCHEMA],
  template: `
    <date-range
      name="stay"
      min="2026-01-01"
      [value]="value"
      (valuechange)="onValuechange($event)"
    ></date-range>
  `,
})
export class DateRangeExample {
  value = { start: '2026-12-18', end: '2026-12-22' };

  onValuechange(event: Event) {
    console.log('valuechange', (event as CustomEvent).detail);
  }
}

API

Properties (each is also an HTML attribute of the same name, unless marked)
PropertyTypeDefault
value
property only
{ start, end }{"start":"","end":""}
minstring""
disabledbooleanfalse
Events
EventWhen
valuechangeEither date changed; detail is the new { start, end }.

Size

1.4 KB gzipped for the component, plus the runtime, which every Zubra component on a page shares (up to 22.1 KB, all of it). On its own, with the parts of the runtime it uses, it's 17.9 KB.

Theme

Every component reads shadcn/ui's CSS variables, so any shadcn theme works. Pick a look or a colour, or paste a theme's CSS.

Look: colours, fonts, corners and motion

Accent colour