Documentation
¶
Overview ¶
templ: version: v0.3.977
Index ¶
Constants ¶
NavigatePath is the standard handler path for calendar navigation. Mount it under your app's base path: basePath + NavigatePath.
Variables ¶
This section is empty.
Functions ¶
func Calendar ¶
Calendar renders a month grid with selectable days controlled by Datastar signals. Week starts on Monday.
func NavigateHandler ¶
func NavigateHandler(calendarID string, mode Mode) http.HandlerFunc
NavigateHandler returns an http.HandlerFunc that handles SSE-based month navigation for a calendar component. The calendarID must match the ID used when rendering the Calendar component so that PatchElementTempl can morph the correct DOM node.
func NavigateHandlerFromQuery ¶
func NavigateHandlerFromQuery() http.HandlerFunc
NavigateHandlerFromQuery returns an http.HandlerFunc that reads the calendar ID and mode from query parameters "id" and "mode". This is useful when a single endpoint serves multiple calendar instances.
Types ¶
type CalendarSignals ¶
type CalendarSignals struct {
Selected string `json:"selected"`
}
CalendarSignals holds the reactive state for a single-select calendar.
type NavigableSignals ¶
type NavigableSignals struct {
}
NavigableSignals holds the reactive state for a navigable calendar. The SSE handler reads/writes these to navigate between months.
type Props ¶
type Props struct {
ID string
Class string
Year int
Month time.Month
Selected string // initial selection in "2006-01-02" format
Mode Mode
RangeStart string // initial range start in "2006-01-02" format
RangeEnd string // initial range end in "2006-01-02" format
}
Props configures a calendar. Year and Month default to the current month when left at zero.
type RangeCalendarSignals ¶
type RangeCalendarSignals struct {
RangeStart string `json:"rangeStart"`
RangeEnd string `json:"rangeEnd"`
}
RangeCalendarSignals holds the reactive state for a range-select calendar.