Range
The range allows users to select a particular range of numbers from which users can choose one by sliding an element to their desired choice.
The range component interprets one type of numbers: float64 for V1.
Ranges can be created on your form as follows:
go
FormRange("volume")Common Methods
For a list of common field component methods, see here.
Max
The max number determines the highest selectable number in the range:
go
// static
FormRange("volume").
Max(100)
// callback
FormRange("volume").
MaxFn(
func(ctx FieldContext) float64 {
return 250
}
)If no value is provided, the default is 100
Min
The min number determines the lowest selectable number in the range:
go
// static
FormRange("volume").
Min(25)
// callback
FormRange("volume").
MaxFn(
func(ctx FieldContext) float64 {
return -100
}
)If no value is provided, the default is 0
Step
The step number determines the step of the slider. For example, a step of 5 means the user can increment or decrement their choice within the chosen range by 5 at a time.
go
// static
FormRange("volume").
Step(5)
// callback
FormRange("volume").
StepFn(
func (ctx FieldContext) float64 {
return 10
}
)