Skip to content

shadcn.io is an independent project built on shadcn/ui

Free

Date Picker with Custom Select Day Style for Solid

A date button set to today. The days are round, and the 6th, 14th and 25th of this month are bold on a tint.

UI library: Ark UI

The button shows a calendar icon and today's date. In the month, the days are round, and the 6th, the 14th and the 25th are bold on a tinted background.

Bold a day when it means something, such as a booked date. A Calendar can mark the same days outside a field. Ark UI in Solid does not know which days are booked.

Preview

Preview width

Installation

MCP · Pro
Make your AI a shadcn expert
Your agent installs components, builds pages and restyles your app from one prompt, in Claude Code, Cursor or VS Code.
Part of Pro

Anatomy

Date Picker anatomy: content, prev trigger, next trigger, table cell, trigger, value

Usage

<DatePicker onValueChange={handleValueChange} positioning={positioning} value={value()}>
      <DatePickerTrigger asChild={props => <Button {...props({
      "class": "w-70 justify-start font-normal"
    })} variant="outline">
          <CalendarIcon aria-hidden="true" data-icon="inline-start" />
          <span>{date ? formatDate(date) : "Pick a date"}</span>
        </Button>} />
      <DatePickerContent>
        <CalendarViewControl>
          <CalendarPrevTrigger />
          <CalendarViewDate />
          <CalendarNextTrigger />
        </CalendarViewControl>
        <CalendarTable>
          <CalendarWeekDays />
          <CalendarContext>
            {calendar => <CalendarTableBody>
                {calendar().weeks.map(week => <CalendarTableRow>
                    {week.map(day => <CalendarTableCell class={cn("rounded-full", isBooked(day) && "bg-warning/20 font-bold text-warning-foreground")} value={day}>
                        {day.day}
                      </CalendarTableCell>)}
                  </CalendarTableRow>)}
              </CalendarTableBody>}
          </CalendarContext>
        </CalendarTable>
      </DatePickerContent>
    </DatePicker>

FAQ

How are the booked days styled?

The example renders the month's weeks itself and gives each day cell rounded-full, plus bg-warning/20 font-bold text-warning-foreground when the day is in the booked list. The selected day keeps the primary fill.

Which days are booked?

The 6th, 14th and 25th of the current month, built once when the module loads. Replace the list with dates from your data.

Can a booked day still be picked?

Yes, the styling doesn't change behavior. To block those days, return true for them from isDateUnavailable, as the disabled dates example does.

What does the button say?

The selected date in long form, such as October 10, 2026, or Pick a date when nothing is selected. The button prints the value itself, formatted with Intl.DateTimeFormat, so the text needs no date library.

Does the highlight follow the theme?

Yes. The colors are the warning tokens, so they change with your theme and in dark mode.

Do screen readers hear that a day is booked?

No, the highlight is visual only. Add the information in text near the picker, or block the days with isDateUnavailable so they're announced as unavailable.

API Reference

Date Picker

Sets onValueChange={handleValueChange}, positioning={positioning}, value={value()}, asChild and props. The rest is on the Date Picker page.

Button

Sets props, w-70, justify-start, font-normal and variant="outline". The rest is on the Button page.

Calendar

Sets value={day}. The rest is on the Calendar page.