Talisman LogoTalisman Logo Design System
Browse documentation
Components

Simple date picker

A button that opens a calendar to pick a single date, with a clear action and no time fields.

Stableimport { SimpleDatePicker } from "@repo/ui/simple-date-picker";Source

Select the button, choose a day and the calendar closes. A Limpar button appears once there is a value.

When to use

  • To choose one date with no time, such as a task deadline or a filing date.
  • In forms and filter bars where a compact button fits.
  • When the calendar needs month and year dropdowns to reach far dates.

When not to use

Sizes

The trigger takes the size of a Button. It defaults to sm (40px).

States

Empty

Disabled

Examples

Restricted dates

disabledDates takes a react-day-picker matcher or a list of them. This example disables weekends. In the product, deadlines also disable days before today.

Content

  • Name the field by what the date means: “Prazo da tarefa”, “Data de distribuição”.
  • Pass placeholder translated. The default is English (“Select date”).
  • The date is always shown as dd/MM/yyyy, whatever the locale. The locale changes the calendar texts.
  • locale defaults to pt-BR. Pass the app locale for other languages.

Accessibility

  • The trigger is a Button inside a Radix Popover: Enter or Space opens it, Escape closes it and focus returns to the trigger.
  • Give the trigger an accessible name: pass id and connect a visible <label> (or a FormLabel). The icon is decorative and the text is only the date or the placeholder.
  • The calendar is react-day-picker: arrow keys move between days, PageUp and PageDown change the month, Enter or Space select. Disabled days have aria-disabled.
  • Month and year are native dropdowns (captionLayout="dropdown"), reachable by keyboard.

Code

import { SimpleDatePicker } from "@repo/ui/simple-date-picker";

const [deadline, setDeadline] = useState<Date | undefined>();

<SimpleDatePicker
  disabledDates={[{ before: new Date() }, { dayOfWeek: [0, 6] }]}
  id="prazo"
  onChange={setDeadline}
  placeholder="Selecione a data"
  value={deadline}
/>;

Props

SimpleDatePicker
PropTypeDefaultDescription
disabledbooleanfalseBlocks opening the calendar
placeholderstring"Select date"Text shown when no date is selected
popoverSide"top" | "right" | "bottom" | "left"—Side of the trigger where the calendar opens
showOutsideDaysbooleantrueShows days from the previous and next month
showWeekNumberbooleanfalseShows the week number column
size"xxs" | "xs" | "sm" | "md" | "lg"—Size of the trigger button
weekStartsOn"0" | "1" | "2" | "3" | "4" | "5" | "6"1First day of the week, from 0 (Sunday) to 6 (Saturday)
More props
PropTypeDefaultDescription
valueDate—Selected date. Controlled by the caller.
onChange(date: Date | undefined) => void—Called when a day is chosen, or with undefined when cleared.
disabledDatesMatcher | Matcher[]—react-day-picker matchers for days that cannot be chosen.
localeLocaleptBRdate-fns locale of the calendar.
idstring—Id of the trigger, to connect a label.
popoverAvoidCollisionsboolean—Set false to keep the calendar anchored inside scrollable parents such as dialogs.
popoverCollisionPaddingnumber—Distance from the viewport edge before the popover flips sides.
calendarComponents, calendarClassNamesCalendarProps['components'], CalendarProps['classNames']—Customization passed to the calendar.
classNamestring—Layout classes for the trigger.

Known issues

Issue Effect
The default placeholder is “Select date” and the footer button “Limpar” is hardcoded. The default is English next to a Portuguese product, and apps cannot translate “Limpar”.
The component has no defaultMonth prop. Without a value the calendar opens on the current month, and a form cannot open it on a due date.
The displayed date is always dd/MM/yyyy. Other locales cannot show their own date format.
The trigger chevron uses opacity-50. Opacity lowers contrast of the icon.
The trigger has no accessible name of its own. Without an external label, a screen reader announces only the date or the placeholder.
Edit this page on GitHub