-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add slider component #40
Comments
Yes definitely possible. btw I use this site for inspiration and to save time with implementing new components, https://originui.com/slider |
@bpmct We are quite limited on the syntax to represent this. Here is the current hcl syntax for a slider data "coder_parameter" "temperature" {
name = "temperature"
display_name = "AI Temperature"
type = "number"
form_type = "slider"
default = 50
count = 1
validation {
min = 0
max = 100
}
} How do you propose we best represent the metadata for the slider? We are currently limited by the terraform provider to a completely static schema. So we could add something like: data "coder_parameter" "temperature" {
name = "temperature"
// ...
slider_metadata = {
tick_labels = {
"Cold" = 0
"Balanced" = 50
"Creative" = 100
}
}
} This would mean we would have Arbitrary metadata fieldThe alternative is to place arbitrary data into a shared data "coder_parameter" "temperature" {
name = "temperature"
// ...
form_type_metadata = {
// Literally put anything you want in here
// An example:
tick_labels = {
"Cold" = 0
"Balanced" = 50
"Creative" = 100
}
}
} Today to accomplish this, we would have to do this: data "coder_parameter" "temperature" {
name = "temperature"
// ...
form_type_metadata = jsonencode({
// Literally put anything you want in here
// An example:
tick_labels = {
"Cold" = 0
"Balanced" = 50
"Creative" = 100
}
})
} |
This feels a bit safer than arbitrary an metadata that we have to read for each field, so it is my slight preference. I know both are not ideal. WIll honestly defer to y'all here. |
Going to create another issue to handle custom styling on form controls such as sliders as there is still some decisions to make. For actually implementing this on the frontend. I would push for either arbitrary metadata or styling defined outside terraform. One issue I can anticipate is edge case in the display of the forms because of the limitations on how to express the styling. These will feel like bugs and it will be more difficult to make the UI responsive to all possible form states. |
The text was updated successfully, but these errors were encountered: