Skip to content

Time Picker

A timepicker.Picker for a time.Duration, split into days, hours, minutes and seconds.

Time Picker

package main

import (
	"go.wdy.de/nago/application"
	"go.wdy.de/nago/presentation/core"
	. "go.wdy.de/nago/presentation/ui"
	"go.wdy.de/nago/presentation/ui/timepicker"
	"go.wdy.de/nago/web/vuejs"
	"time"
)

func main() {
	application.Configure(func(cfg *application.Configurator) {
		cfg.SetApplicationID("de.worldiety.tutorial")
		cfg.Serve(vuejs.Dist())

		cfg.RootView(".", func(wnd core.Window) core.View {
			duration := core.AutoState[time.Duration](wnd).Init(func() time.Duration {
				return time.Minute * 61
			})
			return VStack(
				timepicker.Picker("Dauer", duration).
					SupportingText("Wähle eine tolle Zeit").
					Format(timepicker.DecomposedFormat).
					Days(true).
					Hours(true).
					Minutes(true).
					Seconds(true),
			).
				Frame(Frame{}.MatchScreen())
		})
	}).Run()
}

View on GitHub ↗ · run it with go run go.wdy.de/nago/example/cmd/tutorial-29-timepicker@latest