Skip to content

Long List

A list with 10,000 entries, to see how Nago handles large views.

Long List

package main

import (
	"fmt"

	"go.wdy.de/nago/application"
	"go.wdy.de/nago/presentation/core"
	. "go.wdy.de/nago/presentation/ui"
	"go.wdy.de/nago/presentation/ui/list"
	"go.wdy.de/nago/web/vuejs"
)

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

		buttons := make([]string, 0)
		for i := range 10000 {
			buttons = append(buttons, fmt.Sprintf("List entry %d", i+1))
		}

		cfg.RootView(".", func(wnd core.Window) core.View {
			return VStack(
				list.List(
					ForEach(buttons, func(b string) core.View {
						return list.Entry().Headline(b)
					})...,
				),
			).FullWidth().Alignment(Center)
		})
	}).Run()
}

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