OpenSourceUIOpenSourceUIOpensource UI
GitHubTwitter/X
  1. Home
  2. Components
  3. Calender
  4. Week Strip Calendar
Back to CalenderComponents / Calender

Week Strip Calendar

Free Calender React component — WeekStripCalendar. MIT licensed, copy-paste ready for Next.js and Tailwind CSS.

Horizontal week strip for booking and scheduling apps — arrow through weeks, tap a day to select.

Preview

August 2026

Aug 16 – Aug 22

Setup

How to use

Free for personal and commercial use. No UI attribution required. Include the MIT copyright notice when copying component source into your project. Read the MIT license.

  1. 1

    Run in your terminal:

    $npm install clsx tailwind-merge lucide-react
  2. 2

    Copy lib/cn.ts below. Skip if you already have cn().

  3. 3

    Copy the code below and create components/calender/week-strip-calendar.tsx in your project.

  4. 4

    Import and render:

    Example

    import { WeekStripCalendar } from "@/components/calender/week-strip-calendar";

    <WeekStripCalendar onSelect={(date) => {}} />

lib/cn.ts

1
2
3
4
5
6
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";
 
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

components/calender/week-strip-calendar.tsx

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
"use client";
 
import {
forwardRef,
useMemo,
useState,
type ComponentPropsWithoutRef,
} from "react";
 
import { cn } from "@/lib/cn";
import { ChevronLeft, ChevronRight } from "lucide-react";
 
function startOfWeek(date: Date) {
const copy = new Date(date);
copy.setDate(copy.getDate() - copy.getDay());
copy.setHours(0, 0, 0, 0);
return copy;
}
 
function addDays(date: Date, days: number) {
const copy = new Date(date);
copy.setDate(copy.getDate() + days);
return copy;
}
 
function startOfDay(date: Date) {
const copy = new Date(date);
copy.setHours(0, 0, 0, 0);
return copy;
}
 
function isSameDate(a: Date, b: Date) {
return (
a.getFullYear() === b.getFullYear() &&
a.getMonth() === b.getMonth() &&
a.getDate() === b.getDate()
);
}
 
export type WeekStripCalendarProps = Readonly<
{
onSelect?: (date: Date) => void;
} & ComponentPropsWithoutRef<"div">
>;
 
// Week strip — swipe weeks with arrows, tap a day to select it.
export const WeekStripCalendar = forwardRef<HTMLDivElement, WeekStripCalendarProps>(
({ className, onSelect, ...props }, ref) => {
const today = useMemo(() => startOfDay(new Date()), []);
const [weekStart, setWeekStart] = useState(() => startOfWeek(today));
const [selected, setSelected] = useState(today);
const [slideDirection, setSlideDirection] = useState(0);
 
const days = useMemo(
() => Array.from({ length: 7 }, (_, index) => addDays(weekStart, index)),
[weekStart],
);
 
const monthLabel = days[3]?.toLocaleDateString("en-US", {
month: "long",
year: "numeric",
});
 
const rangeLabel = `${days[0]?.toLocaleDateString("en-US", { month: "short", day: "numeric" })} – ${days[6]?.toLocaleDateString("en-US", { month: "short", day: "numeric" })}`;
 
const selectDay = (date: Date) => {
setSelected(startOfDay(date));
onSelect?.(startOfDay(date));
};
 
const goPrevWeek = () => {
setSlideDirection(-1);
setWeekStart((prev) => addDays(prev, -7));
};
 
const goNextWeek = () => {
setSlideDirection(1);
setWeekStart((prev) => addDays(prev, 7));
};
 
return (
<div
ref={ref}
data-slot="week-strip-calendar"
className={cn(
"w-80 overflow-hidden rounded-2xl border border-neutral-100 bg-white px-5 py-4 font-sans select-none",
"shadow-[0_0_0_1px_rgba(0,0,0,0.04),0_1px_2px_rgba(0,0,0,0.05),0_4px_8px_rgba(0,0,0,0.06),0_12px_24px_rgba(0,0,0,0.04)]",
className,
)}
{...props}
>
<div className="mb-1 flex items-center justify-between">
<p className="text-sm font-semibold text-neutral-900">{monthLabel}</p>
<div className="flex items-center gap-0.5">
<button
type="button"
aria-label="Previous week"
onClick={goPrevWeek}
className="flex size-8 cursor-pointer items-center justify-center rounded-full text-neutral-500 outline-none transition-colors duration-150 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-neutral-800"
>
<ChevronLeft size={16} strokeWidth={2} aria-hidden />
</button>
<button
type="button"
aria-label="Next week"
onClick={goNextWeek}
className="flex size-8 cursor-pointer items-center justify-center rounded-full text-neutral-500 outline-none transition-colors duration-150 hover:bg-neutral-100 hover:text-neutral-900 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-neutral-800"
>
<ChevronRight size={16} strokeWidth={2} aria-hidden />
</button>
</div>
</div>
 
<p
key={rangeLabel}
className="mb-4 text-xs font-medium text-neutral-500 opacity-100 transition-opacity duration-300 ease-out starting:opacity-0"
>
{rangeLabel}
</p>
 
<div
key={weekStart.toISOString()}
className={cn(
"grid grid-cols-7 opacity-100 transition-all duration-300 ease-[cubic-bezier(0.25,0.46,0.45,0.94)] starting:opacity-0",
slideDirection >= 0
? "starting:translate-x-2"
: "starting:-translate-x-2",
)}
>
{days.map((date) => {
const isSelected = isSameDate(date, selected);
const isToday = isSameDate(date, today);
 
return (
<button
key={date.toISOString()}
type="button"
aria-pressed={isSelected}
onClick={() => selectDay(date)}
className="group flex cursor-pointer flex-col items-center gap-1.5 outline-none"
>
<span
className={cn(
"text-[10px] font-medium tracking-wide uppercase",
isSelected ? "text-neutral-800" : "text-neutral-400",
)}
>
{date.toLocaleDateString("en-US", { weekday: "narrow" })}
</span>
<span
className={cn(
"relative flex size-9 items-center justify-center rounded-full text-sm font-medium tabular-nums",
"transition-colors duration-150",
"group-focus-visible:outline-2 group-focus-visible:outline-offset-1 group-focus-visible:outline-neutral-800",
isSelected && "bg-neutral-800 font-semibold text-white",
!isSelected &&
isToday &&
"bg-neutral-100 font-semibold text-neutral-800 group-hover:bg-neutral-200",
!isSelected &&
!isToday &&
"text-neutral-700 group-hover:bg-neutral-100",
)}
>
{date.getDate()}
{isToday && !isSelected && (
<span
aria-hidden
className="absolute -bottom-0.5 left-1/2 size-1 -translate-x-1/2 rounded-full bg-neutral-800"
/>
)}
</span>
</button>
);
})}
</div>
</div>
);
},
);
 
WeekStripCalendar.displayName = "WeekStripCalendar";
PreviousNext

On this

page

Jump to a section on this page.

  • lib/cn.ts
  • components/calender/week-strip-calendar.tsx

Sponsor spot · demo preview

Logo

Your brand name

Your tagline or category

A short pitch about your product or service goes here. This is a preview of how sponsor cards will look in this sidebar.

Your call to action

This slot is available. Sponsor Opensource UI and reach developers browsing components every day.