Ship faster with goilerplate templUI Pro

Date Picker

Calendar interface for selecting and formatting dates. Uses Calendar for date selection and Popover for the popup.

Source Tailwind CSS JavaScript

Installation

templui add datepicker

Load the script once in your layout:

<head>
  @datepicker.Script()
</head>

Examples

With Label

Custom Placeholder

Selected Date

Disabled

Formats

With Time

Form

Select a date from the calendar.

Select a valid date

API Reference

Required parameter
Hover for description

DatePicker

Main date picker component that triggers the popover calendar.

Name Type Default
ID

Unique identifier for the date picker component

string
randomID
Class

Additional CSS classes to apply to the trigger button

string
""
Attributes

Additional HTML attributes to apply to the trigger button

templ.Attributes
nil
Value

Current selected date value

time.Time
time.Time{}
Format

Display format for the selected date

Format
locale-medium
LocaleTag

BCP 47 Locale Tag for language and regional format

LocaleTag
en-US
StartOfWeek

Optional start of week passed to Calendar component. When nil, Calendar defaults to Monday. Use calendar.Sunday through calendar.Saturday constants.

*calendar.Day
nil
Placeholder

Placeholder text when no date is selected

string
Select a date
Disabled

Whether the date picker is disabled

bool
false
HasError

Whether the date picker should display error styling

bool
false
Name

Name attribute for the hidden input field

string
ID value