shadcn.io is an independent project built on shadcn/ui
Components
Free
Mini Calendar for Svelte
A strip of days between two arrows that page through them, for picking a day close to today. For Svelte on Ark UI, with no date library.
On this page9 sections
UI library: Ark UI
A mini calendar shows a short run of days in a row, each with its month and number, between two arrows that page through them. It suits a day that is close at hand, such as a delivery slot, a class this week or an appointment, where a whole month would be more than people need.
When the day could be weeks or months away, use a Calendar, or a Date Picker inside a form.
Installation
Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.
The strip is a group, so give MiniCalendar an aria-label that says what the day is for, as every demo does. Each day is a toggle button named with its full date, such as Wednesday, November 11, 2026, pressed while it is selected and marked as the current date when it is today. Only one day is in the tab order, and the arrows either side are labeled with the strip's own count, such as Previous 5 days, in English unless you give each one an aria-label.
KeyAction
Tab
Moves focus into the days, onto the day last moved to, the selected day, today or the first day, in that order, and from there to the next arrow.
Arrow Left
Moves focus to the previous day, paging the strip back when it passes the first one. On a right-to-left page it moves to the next day.
Arrow Right
Moves focus to the next day, paging the strip on when it passes the last one. On a right-to-left page it moves to the previous day.
Home
Moves focus to the first day in view.
End
Moves focus to the last day in view.
Page Up
Moves focus back by as many days as the strip shows, and pages the strip with it.
Page Down
Moves focus on by as many days as the strip shows, and pages the strip with it.
Enter
Selects the focused day.
Space
Selects the focused day.
Demos
Controlled
Five days, with the selected day and the first day in view both held in state, the selected date written out below, or No day selected, and a Today button that sets both back to today. Hold startDate when something outside the strip has to move it, as that button does, and value when the day feeds the rest of a form.
Days
Two strips, one of three days and one of five, set with days, and each arrow pages by its own count. Both start on today, so the five-day strip shows the next five days, weekend included. Choose the count from the room you have and from how far ahead people usually pick.
Week strip
Seven days from this week's Monday to Sunday, with the week's first day written under the strip. The Monday is worked out once the page runs in the browser, since the server can't know the visitor's day, and held in startDate, which onStartDateChange updates as the strip pages. The arrows then move a whole week at a time. Use it for a weekly schedule, such as classes or shifts.
Weekends
Seven days from today, with Saturday and Sunday dimmed by one MiniCalendarDay placed inside MiniCalendarDays and styled on data-weekend. MiniCalendarDays renders that child once for every day in view, and a day without a date takes the one it is rendered for. The dimmed days can still be selected, so this marks weekends without blocking them.
FAQ
When should I use a Mini Calendar instead of a Calendar?
Use a Mini Calendar when the day is close at hand and people pick from a few options in a row: a delivery slot, a class this week, an appointment in the next few days. It takes one line of space and starts on today.
Use a Calendar when the date could be weeks or months away, when people pick a range or several days, or when seeing the month laid out by weekday helps them choose. A Mini Calendar selects one day and has no range mode.
How do I control the selected day of the Mini Calendar?
Pass value and onValueChange to MiniCalendar, as the Controlled demo does, or defaultValue for a strip that keeps its own state. The value is a Date at local midnight, or null while nothing is selected, and clicking the selected day again keeps it selected. startDate and onStartDateChange control which days are in view the same way, with defaultStartDate for the uncontrolled form.
How do I change how many days the Mini Calendar shows?
Set days, which is 5 by default. The arrows page by the same count, and so do PageUp and PageDown, so 7 moves a week at a time, as the Days demo shows with three and five.
The strip doesn't wrap or shrink, and each day is a 44-pixel column, so choose a smaller count where the screen is narrow.
How do I make the Mini Calendar start on Monday or on a given date?
Pass the first day you want as startDate and update it from onStartDateChange, as the Week strip demo does with this week's Monday. A day that is the same on the server and in every browser, such as the first day of a course, can go in defaultStartDate instead.
The arrows page by days from that point, so a seven-day strip that starts on a Monday stays aligned to weeks. The component has no week setting, so work out the Monday with plain Date math once the page runs in the browser: the server doesn't know the visitor's day and can land on the wrong week.
How is today marked in the Mini Calendar?
Today's button gets a tinted background, unless it is also the selected day, which is filled, and it carries aria-current="date" and data-today.
Today is read in the browser after the page loads, in the visitor's own time zone, so the server never guesses the date. Without a start date, the server renders empty placeholders where the days go and the days appear once the browser knows today.
How do I style weekends or other days in the Svelte Mini Calendar?
Put one MiniCalendarDay inside MiniCalendarDays with your classes: it renders once for every day in view, each time for that day, as the Weekends demo does. Target data-weekend, data-today or data-selected in those classes.
Children you pass to MiniCalendarDay replace the month and number on every day alike, since the day's date isn't handed to them. For content that changes per day, such as a price, edit MiniCalendarDay in components/ui/mini-calendar.
How do I show the Mini Calendar's month names in another language?
Pass locale, such as fr-FR. The short month above each number and each day's full-date label are written by Intl.DateTimeFormat in that locale, and it is fixed to en-US by default rather than read from the browser, so the server and the browser write the same text.
The arrows' labels, Previous 5 days and Next 5 days, are English by default. Give each MiniCalendarNavigation an aria-label in your language and it replaces them.
API Reference
MiniCalendar
PropType
startDate?Date
The first day in view (controlled).
defaultStartDate?Date
The first day in view when uncontrolled. @default today.
onStartDateChange?(date: Date) → void
Called with the first day in view when the strip pages.
Parameters
date – Date
Returns
void
value?Date | null
The selected day (controlled).
Type
Date | null
defaultValue?Date | null
The day selected at first when uncontrolled.
Type
Date | null
Default
null
onValueChange?(value: Date) → void
Called with the day a person selects.
Parameters
value – Date
Returns
void
days?number
How many days the strip shows; the arrows page by as many.
Default
5
locale?string
The locale month names and the days' labels are written in. Fixed by
default, so the server and the browser write them the same way.
Default
"en-US"
class?string
Merged with the part's classes.
MiniCalendarNavigation
data-slot="mini-calendar-navigation"
PropType
directionMiniCalendarDirection
Which way the strip pages, by as many days as it shows.