Skip to main content

Date Input

The Date Input widget provides a specialized input field for selecting dates with a calendar picker interface.

States

StateTypeDefaultDescription
valuestringNoneCurrent selected date value

Properties

PropertyTypeDefaultDescription
labelstring""Label text displayed above the input
placeholderstring""Placeholder text displayed when no date is selected
default_valuestringNoneInitial date value
requiredboolFalseWhether a date selection is required
disabledboolFalseWhether the date input is disabled
formatstring"YYYY-MM-DD"Format string for date display
max_valuestringNoneMaximum selectable date
min_valuestringNoneMinimum selectable date

Examples

Basic Date Input

package main

import (
"github.com/trysourcetool/sourcetool-go"
"github.com/trysourcetool/sourcetool-go/dateinput"
)

func main() {
func page(ui sourcetool.UIBuilder) error {
// Create a basic date input
dateInput := ui.DateInput("Date", dateinput.Placeholder("Select a date"))
}
}

Date Input with Custom Format

// Create a date input with custom format
dateInput := ui.DateInput("Date", dateinput.Placeholder("Select a date"), dateinput.Format("MM/DD/YYYY"))

Date Input with Range Constraints

// Create a date input with range constraints
dateInput := ui.DateInput("Date", dateinput.Placeholder("Select a date"), dateinput.MinValue(time.Now()), dateinput.MaxValue(time.Now().AddDate(0, 0, 30)))

Disabled Date Input with Default Value

// Create a disabled date input with a default value
dateInput := ui.DateInput("Date", dateinput.Placeholder("Select a date"), dateinput.Disabled(true))