Docs
Range Calendar
Range Calendar
A calendar component that allows users to select a range of dates.
<script lang="ts">
import { getLocalTimeZone, today } from "@internationalized/date";
import { RangeCalendar } from "$lib/components/ui/range-calendar/index.js";
const start = today(getLocalTimeZone());
const end = start.add({ days: 7 });
let value = $state({
start,
end
});
</script>
<RangeCalendar bind:value class="rounded-md border shadow" />
<script lang="ts">
import { getLocalTimeZone, today } from "@internationalized/date";
import { RangeCalendar } from "$lib/components/ui/range-calendar/index.js";
const start = today(getLocalTimeZone());
const end = start.add({ days: 7 });
let value = $state({
start,
end
});
</script>
<RangeCalendar bind:value class="rounded-md border" />
About
The <RangeCalendar />
component is built on top of the Bits Range Calendar component, which uses the @internationalized/date package to handle dates.
Installation
npx shadcn-svelte@next add range-calendar
Install bits-ui
and @internalized/date
:
npm i bits-ui @internationalized/date -D
Copy and paste the component source files linked at the top of this page into your project.
On This Page