calendar

package
v0.0.0-...-8815ff5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

templ: version: v0.3.960

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Calendar

func Calendar(args CalendarArgs) templ.Component

Calendar renders a simple, elegant calendar

func CalendarDay

func CalendarDay(args CalendarDayArgs) templ.Component

CalendarDay renders individual day button with pre-calculated data

func CalendarGrid

func CalendarGrid(args CalendarGridArgs) templ.Component

CalendarGrid renders the calendar days

func CalendarHeader

func CalendarHeader(args CalendarHeaderArgs) templ.Component

CalendarHeader renders the month navigation

Types

type CalendarArgs

type CalendarArgs struct {
	// ID for the calendar (auto-generated if not provided)
	ID string

	// Mode defines the selection mode
	// Options: "single", "range"
	Mode string

	// NumberOfMonths defines how many months to display side by side
	// Default: 1, for double-width use 2
	NumberOfMonths int

	// HideOutsideDays determines whether to hide dates from adjacent months
	// Default: false (outside days are shown by default)
	HideOutsideDays bool

	// DefaultDate sets the initial month to display (YYYY-MM-DD format)
	// Will be normalized to the first day of the month
	DefaultDate string

	// SelectedDate for single mode (YYYY-MM-DD format)
	SelectedDate string

	// RangeStart for range mode (YYYY-MM-DD format)
	RangeStart string

	// RangeEnd for range mode (YYYY-MM-DD format)
	RangeEnd string

	// Disabled dates (comma-separated YYYY-MM-DD format)
	Disabled string

	// Class allows additional CSS classes to be added
	Class string

	// Attributes allows additional HTML attributes to be added
	Attributes templ.Attributes

	// Signal coordination
	DatePickerInputsID string // ID of date picker inputs to send signals to for synchronization

	// MinDate for date range mode (YYYY-MM-DD format)
	MinDate string

	// MaxDate for date range mode (YYYY-MM-DD format)
	MaxDate string
}

CalendarArgs defines the properties for the Calendar component

type CalendarDayArgs

type CalendarDayArgs struct {
	// ID of the parent calendar
	ID string

	// DayIndex is the index of this day (0-41 for 6 weeks)
	DayIndex int

	// MonthOffset is used for multi-month calendars (0 for current month, 1 for next month, etc.)
	MonthOffset int

	// HideOutsideDays determines whether to hide dates from adjacent months
	HideOutsideDays bool

	// CurrentDateStr is the current month being displayed (YYYY-MM-DD format)
	CurrentDateStr string

	// Mode defines the selection mode ("single" or "range")
	Mode string

	// Signal coordination
	DatePickerInputsID string // ID of date picker inputs to send signals to for synchronization
}

CalendarDayArgs defines the properties for individual calendar day buttons

type CalendarDayData

type CalendarDayData struct {
	DateString     string // YYYY-MM-DD format
	DayNumber      int    // Day of month (1-31)
	IsCurrentMonth bool   // Is this day in the target month
	IsToday        bool   // Is this today's date
	IsOutsideDay   bool   // Is this day outside the target month
}

CalendarDayData represents pre-calculated day information

type CalendarGridArgs

type CalendarGridArgs struct {
	// ID of the parent calendar
	ID string

	// MonthOffset is used for multi-month calendars (0 for current month, 1 for next month, etc.)
	MonthOffset int

	// HideOutsideDays determines whether to hide dates from adjacent months
	HideOutsideDays bool

	// NumberOfMonths defines how many months the parent calendar displays
	NumberOfMonths int

	// CurrentDateStr is the current month being displayed (YYYY-MM-DD format)
	CurrentDateStr string

	// Mode defines the selection mode ("single" or "range")
	Mode string

	// Signal coordination
	DatePickerInputsID string // ID of date picker inputs to send signals to for synchronization
}

CalendarGridArgs defines the properties for the calendar day grid

type CalendarHeaderArgs

type CalendarHeaderArgs struct {
	// ID of the parent calendar
	ID string

	// NumberOfMonths defines how many months to display
	NumberOfMonths int
}

CalendarHeaderArgs defines the properties for the calendar header

type CalendarSignals

type CalendarSignals struct {
	CurrentDate string `json:"currentDate"`
	Mode        string `json:"mode"`
	Today       string `json:"today"`
	DateValue   string `json:"dateValue"`  // ISO date value for single mode
	InputValue  string `json:"inputValue"` // Formatted input display value
	RangeStart  string `json:"rangeStart"`
	RangeEnd    string `json:"rangeEnd"`
}

CalendarSignals defines the signal structure for calendar components

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL