Class Tools

Demonstrates different uses of class-tools

return Div(
	hx.Ext(classtools.Extension),
	P(g.Text("Add then remove bold after 1 second, then toggle color every second"),
		classtools.Classes(hx,
			classtools.Add("bold", time.Second),
			classtools.Remove("bold", time.Second),
			classtools.Toggle("color", time.Second),
		),
	),
	P(g.Text("Add then remove bold after 1 second, while toggling color every second"),
		classtools.ClassesParallel(hx, []classtools.Run{
			{
				classtools.Add("bold", time.Second),
				classtools.Remove("bold", time.Second),
			},
			{
				classtools.Toggle("color", time.Second),
			},
		}),
	),
	P(g.Text("Add with no delay"),
		classtools.Classes(hx, classtools.Add("color", 0)),
	),
	P(g.Text("Toggle with 0 delay"),
		classtools.Classes(hx, classtools.Toggle("color", 0)),
	),
)

Demo

Add then remove bold after 1 second, then toggle color every second

Add then remove bold after 1 second, while toggling color every second

Add with no delay

Toggle with 0 delay