Skip to content

[Slider] Slider needs a steps property #1156

@shawnlinboy

Description

@shawnlinboy

Specification Version

v0_10

According doc

https://github.com/google/A2UI/blob/main/specification/v0_10/json/basic_catalog.json#L562

Issue

While implementing the Slider recently, our team noticed that the steps parameter was missing. This parameter is extremely useful in many practical scenarios (such as the temperature range for air conditioners or the speed range for fans), so we propose adding it as an optional parameter to the standard.

Similarly, we can also see this parameter in the Compose implementation on the Android platform.
https://developer.android.com/develop/ui/compose/components/slider#advanced-implementation

Image

Break-down

To make it easier for large language models to understand, We propose that this value be described as “the difference between every two options,” to distinguish it from Compose’s native definition: “The number of notches on the slider to which the thumb snaps.”

Taking the Android platform using Jetpack Compose as an example:

If we want to draw [0,2,4,6,8,10], according to Compose’s native definition, the steps value should be 4, corresponding to the 4 points “2,4,6,8.”
However, to make the model easier to understand and less prone to errors, we propose that in this scenario, steps should be 2, representing “a separation every 2 numbers.” The rendering layer can calculate the required steps value for the control using (maxValue - minValue) / steps - 1.

This helps reduce the model's complexity and prevent errors.

Follow-up

We may submit a PR regarding this issue later; for now, please feel free to discuss it here.

Metadata

Metadata

Assignees

Labels

P2sprint readyThis issue should be included in sprint planning views

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions