lotusui the ikaito design language for Gio — desktop, mobile, web
GitHub

Slider

The draggable value: track, brand fill, a ringed thumb.

Value is a fraction in [0, 1] — map it to your domain at the call site. Press or drag anywhere on the control; Step snaps to multiples.

Installation

Use the module import (the default), or own the source: lotusui add vendors the component into your app and lotusui update keeps the copy mergeable — see Registry.

Go
go get github.com/ikaito-com/lotusui

# or vendor the source into your app:
go run github.com/ikaito-com/lotusui/cmd/lotusui add slider

Usage

Go
var volume = lotusui.Slider{Value: 0.4}
volume.Layout(th, gtx)
percent := volume.Value * 100

Step

Go
quarters := lotusui.Slider{Step: 0.25}

Disabled

Go
s.Disabled = true

Range

Values with two entries — two thumbs, the fill between them; each stays between its neighbors.

Go
s := lotusui.Slider{Values: []float32{0.25, 0.5}, Step: 0.05}

Multiple

Any number of entries — one thumb each.

Go
s := lotusui.Slider{Values: []float32{0.1, 0.2, 0.7}, Step: 0.1}

Vertical

Vertical rotates the axis; cap the height at the call site — the value grows upward.

Go
s := lotusui.Slider{Value: 0.5, Vertical: true}
gtx.Constraints.Max.Y = gtx.Dp(160)
s.Layout(th, gtx)

API

OptionTypeDescription
Valuefloat32Fraction in [0, 1] — map to your domain at the call site.
Values[]float32Multi-thumb mode: one thumb per entry, kept ordered; two = range.
Stepfloat32Snaps to multiples; zero = continuous.
VerticalboolRotates the axis; the value grows upward.
DisabledboolDimmed, inert.

Every demo on this site is the real Go component compiled to WebAssembly — one gallery app, one bundle, addressed by URL hash.