shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Calendar

A calendar component that allows users to select a date or a range of dates.

package examples import (

Installation

shadcn-templ add calendar

Usage

import (	"time" 	"github.com/axadrn/shadcn-templ/v2/components/calendar")
@calendar.Calendar(calendar.Props{	Selected: time.Now(),	Class: "rounded-lg border",})

About

The Calendar component is a native templ and vanilla JavaScript implementation with no external dependencies.

Date Picker

You can use the Calendar component to build a date picker. See the Date Picker page for more information.

Basic

A basic calendar component. We used Class: "rounded-lg border" to style the calendar.

August 2026
package examples import "github.com/axadrn/shadcn-templ/v2/components/calendar"

Range Calendar

Use the Mode: calendar.ModeRange prop to enable range selection.

January 2026
February 2026
package examples import (

Month and Year Selector

Use CaptionLayout: calendar.CaptionLayoutDropdown to show month and year dropdowns.

package examples import "github.com/axadrn/shadcn-templ/v2/components/calendar"

Presets

February 2026
package examples import (

Date and Time Picker

August 2026
package examples import (

Booked dates

January 2026
package examples import (

Custom Cell Size

package examples import (

You can customize the size of calendar cells using the --cell-size CSS variable. You can also make it responsive by using breakpoint-specific values:

@calendar.Calendar(calendar.Props{	Class: "rounded-lg border [--cell-size:--spacing(11)] md:[--cell-size:--spacing(12)]",})

Or use fixed values:

@calendar.Calendar(calendar.Props{	Class: "rounded-lg border [--cell-size:2.75rem] md:[--cell-size:3rem]",})

Week Numbers

Use ShowWeekNumber to show week numbers.

January 2026
package examples import (

API Reference

Calendar

The Calendar component displays a month grid for selecting a date or a range of dates.

Prop Type Default
Mode ModeSingle | ModeRange ModeSingle
CaptionLayout CaptionLayoutLabel | CaptionLayoutDropdown CaptionLayoutLabel
Selected time.Time -
EndValue time.Time -
Month time.Time Selected or now
Name string -
EndName string Name + "-end"
Locale string (BCP 47, e.g. “de-DE”) "en-US"
WeekStartsOn Day Sunday
HideOutsideDays bool false
FixedWeeks bool false
ShowWeekNumber bool false
MinDate time.Time -
MaxDate time.Time -
Disabled []time.Time -
BookedDates []time.Time -
NumberOfMonths int 1
Class string -