Skip to content

Pickers

Pickers let the user choose a structured value, such as a date, a time or a font, without typing it in a particular format.

Which one to use

You wantUse
A date chosen on a calendar, shown in placeNewDatePicker
A date or time chosen in a dialog from a buttonShowDatePicker, ShowTimePicker, ShowDateTimePicker
A form field where the user can type a date or open a calendarNewDateEntry
The same for a date and a timeNewDateTimeEntry
A time on a clock dial, shown in placeNewTimePicker
One item from a short list, on a wheel the user spinsNewWheelPicker
A font family, size, weight and styleNewFontPicker, NewFontPickerWithSystemFonts
A light, dark or system appearance setting with a colourNewThemeSelector

Date and time pickers

DatePicker is a month calendar. Selected holds the chosen date and OnChanged receives each new one.

A date picker showing March 2026 with the 9th selected, arrows to the previous and next month either side of the title, and weekday initials above the days A date picker showing March 2026 with the 9th selected, arrows to the previous and next month either side of the title, and weekday initials above the days
calendar := widget.NewDatePicker(time.Now(), func(d time.Time) {
	status.SetText("Date: " + d.Format("2006-01-02"))
})

With the keyboard, the arrow keys move between days (and into the next or previous month), Home and End jump to the edges of the week, Page Up and Page Down move a month, and Enter or Space selects.

TimePicker is the MD3 clock dial. Hour and Minute hold the time, and Use24Hour switches between the 24-hour dial and AM/PM. The user can also type digits into the hour and minute fields.

A time picker in 12-hour mode set to 09:41 AM: hour and minute fields with an AM/PM switch above a clock dial whose hand points at 9 A time picker in 12-hour mode set to 09:41 AM: hour and minute fields with an AM/PM switch above a clock dial whose hand points at 9

DateTimePicker puts a date picker and a time picker on two tabs, switched with Date and Time buttons above them.

A date and time picker with Date selected in a two-button switch above the March 2026 calendar A date and time picker with Date selected in a two-button switch above the March 2026 calendar

Each picker has a Show function that opens it in a modal dialog with OK and Cancel buttons. Your function runs only when the user presses OK:

pickTime := widget.NewButton("Pick a time", func() {
	now := time.Now()
	widget.ShowAutoTimePicker(now.Hour(), now.Minute(), func(h, m int) {
		status.SetText(fmt.Sprintf("Time: %02d:%02d", h, m))
	}, w.Canvas())
})

pickBoth := widget.NewButton("Pick date and time", func() {
	widget.ShowAutoDateTimePicker(time.Now(), func(t time.Time) {
		status.SetText("When: " + t.Format(time.RFC822))
	}, w.Canvas())
})
PickerIn placeIn a dialog
DateNewDatePickerShowDatePicker
TimeNewTimePicker, NewAutoTimePickerShowTimePicker, ShowAutoTimePicker
Date and timeNewDateTimePicker, NewAutoDateTimePickerShowDateTimePicker, ShowAutoDateTimePicker

The Auto variants choose 12-hour or 24-hour mode from the user’s locale. The others take a use24h argument.

Date entries

DateEntry and DateTimeEntry are entries for forms. The user types a date in the locale’s format, or taps the button at the end of the field to open a calendar. Characters that cannot be part of a date are ignored, including in pasted text.

A form with Birthday, Meeting and Deadline fields: 07/14/1990, 03/09/2026 9:41 AM and an empty field showing Not set, each with a calendar button at its end A form with Birthday, Meeting and Deadline fields: 07/14/1990, 03/09/2026 9:41 AM and an empty field showing Not set, each with a calendar button at its end
birthday := widget.NewDateEntry()
birthday.SetPlaceHolder("Birthday")
birthday.OnChanged = func(d time.Time) {
	status.SetText("Birthday " + d.Format("2 Jan 2006"))
}

meeting := widget.NewDateTimeEntry()
meeting.SetDateTime(time.Now().Add(24 * time.Hour))
meeting.OnChanged = func(t time.Time) {
	status.SetText("Meeting " + t.Format(time.Kitchen))
}
  • Use the entry’s own OnChanged, which receives a time.Time. The embedded Entry.OnChanged receives the raw text instead.
  • Selected holds the last valid value. Date() and DateTime() parse the current text and return an error if it is not valid.
  • SetDate and SetDateTime write a value in the locale’s format.
  • DateTimeEntry.Use24Hour is set from the locale and controls the time picker it opens.

Wheel picker

WheelPicker is a short column of items the user spins through, like the picker wheels on iOS and Android. The item in the middle is the selection.

var hours []core.CanvasObject
for h := 0; h < 24; h++ {
	hours = append(hours, widget.NewLabel(fmt.Sprintf("%02d", h)))
}
wheel := widget.NewWheelPicker(hours, func(i int) {
	status.SetText(fmt.Sprintf("Hour: %02d", i))
})
wheel.Wrap = true // after 23 comes 00
wheel.SetSelectedSilently(9)
wheel.SetAccessibilityLabel("Hour")
  • A drag spins the wheel and a flick lets it coast. It always settles with one item in the middle. A tap on another item spins that item to the middle.
  • OnChanged runs once for each change, when the wheel settles, not while it spins. SetSelected changes the selection from code and fires OnChanged; SetSelectedSilently does not.
  • Without Wrap the wheel stops at the first and last items. With Wrap the items form a ring.
  • Orientation is widget.Vertical (the default) or widget.Horizontal.
  • VisibleItems is how many items show at once (5 by default; an even count is rounded up). Items away from the middle are drawn smaller and fainter: ShrinkTo and FadeTo set the scale (0.7 by default) and opacity (0.3 by default) at the edge.

The items are any canvas objects. Screen readers treat the wheel as an adjustable control: they read the selected item’s label and step the selection by one. Name the wheel itself with SetAccessibilityLabel.

Font picker

FontPicker combines controls for a font family, size, weight and style. It reports a FontPickerConfig with Family, Size, Weight, Bold, Italic and Underline. TextStyle() turns that into a bellui.TextStyle for a label or rich text.

font := widget.NewFontPickerWithSystemFonts(
	widget.FontPickerConfig{Size: 14},
	func(cfg widget.FontPickerConfig) {
		preview.TextStyle = cfg.TextStyle()
		preview.SetText(fmt.Sprintf("%s, %.0f pt", cfg.Family, cfg.Size))
	})

NewFontPickerWithSystemFonts lists the fonts installed on the system, loading the list in the background. NewFontPicker takes your own FontFamily list, each with a name and the font file as a resource. ShowFontPickerPopup opens a picker in a modal dialog with OK and Cancel buttons.

Theme selector

ThemeSelector is a ready-made appearance setting: System, Light or Dark above a row of primary colour swatches. It only reports the user’s choice. Call ThemeSelection.Apply to re-theme the app and SaveThemeSelection to remember it:

appearance := widget.NewThemeSelector(func(sel widget.ThemeSelection) {
	sel.Apply()
	widget.SaveThemeSelection(sel, a.Preferences())
})
// Restore the choice saved last time.
if sel, ok := widget.LoadThemeSelection(a.Preferences()); ok {
	sel.Apply()
	appearance.Selection = sel
}

Theme selector in the Theming section covers it in more detail.