Skip to content

docs: add new dynamic parameters information to parameters doc #17653

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

Merged
merged 19 commits into from
May 19, 2025

Conversation

EdwardAngert
Copy link
Contributor

@EdwardAngert EdwardAngert commented May 1, 2025

closes #17622

it might be better to have the examples on their own page, but if we /parameters/index.md + /parameters/dynamic-parameter-examples.md we're going to have to do a bunch of find/replacing everywhere

preview

@EdwardAngert EdwardAngert added the docs Area: coder.com/docs label May 1, 2025
@EdwardAngert EdwardAngert requested a review from stirby May 1, 2025 20:56
@EdwardAngert EdwardAngert self-assigned this May 1, 2025
@EdwardAngert
Copy link
Contributor Author

for #17473

Comment on lines 457 to 471
The "Options" column in the table below indicates whether the form type requires options to be defined (Yes) or doesn't support/require them (No). When required, options are specified using one or more `option` blocks in your parameter definition, where each option has a `name` (displayed to the user) and a `value` (used in your template logic).

| Form Type | Parameter Types | Options | Notes |
|----------------|--------------------------------------------|---------|---------------------------------------------------------------------------------------------------------------------------------|
| `checkbox` | `bool` | No | A single checkbox for boolean parameters.<br>Default for boolean parameters. |
| `dropdown` | `string`, `number` | Yes | Searchable dropdown list for choosing a single option from a list.<br>Default for `string` or `number` parameters with options. |
| `input` | `string`, `number` | No | Standard single-line text input field.<br>Default for string/number parameters without options. |
| `key-value` | `string` | No | For entering key-value pairs (as JSON). |
| `multi-select` | `list(string)` | Yes | Select multiple items from a list with checkboxes. |
| `password` | `string` | No | Masked input field for sensitive information. |
| `radio` | `string`, `number`, `bool`, `list(string)` | Yes | Radio buttons for selecting a single option with all choices visible at once. |
| `slider` | `number` | No | Slider selection with min/max validation for numeric values. |
| `switch` | `bool` | No | Toggle switch alternative for boolean parameters. |
| `tag-select` | `list(string)` | No | Default for list(string) parameters without options. |
| `textarea` | `string` | No | Multi-line text input field for longer content. |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can simplify this, but I'll come back to it. We can release this as is for now

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's that bad as a table (preview), it's the examples below that I'd love to make nicer (and apparently you can't bold in a <details><summary>, so the md is currently busted

@stirby suggested tabs, so I'll try that next if we're good with the basic feel

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh wait - I wonder if I can make an Example column with the expands. brb

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stirby @Emyrk it's not perfect (or complete), but here's a proof of concept

2025-05-16_12-57-43

edit: I forgot to tell it to include my cursor in the recording

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine for sure. I just wonder if I can make something a bit more interactive.

Can we embed any html/js in here? Or no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm often surprised by the things that work or don't work on our site, but it is built using Next, so there are probably options I wouldn't think of?

if you've got an idea, I'm always happy to test it out + add improvements to the site

in the meantime, we all 👍 on moving the examples to the table?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for now yes! Let's merge this.

I admit I do not have a great idea at the moment, I just know the table is a verbose thing to look at, and hard to mentally parse if you are not already familiar.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll work on putting the examples into the table today + let's follow up with a PR with a screenshot of every option

do you have a kitchensink-style template I can grab from?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of. This has all the form types, but it dynamically switches them

https://github.com/coder/preview/blob/main/testdata/formtypes/main.tf

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm stuck on trying to get these examples to render nicely in the table - I'll leave them as separate for now, and we'll come back to it. I don't want that blocking publishing


## Available Form Types

Dynamic Parameters supports a variety of form types to create rich, interactive user experiences.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requires coder terraform provider >2.4.0

terraform {
  required_providers {
    coder = {
      source = "coder/coder"
      version = ">=2.4.0"
    }
  }
}

https://registry.terraform.io/providers/coder/coder/latest/docs

@stirby stirby requested a review from Emyrk May 16, 2025 22:05
Copy link
Member

@Emyrk Emyrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My nits do no block a merge 👍

@stirby stirby enabled auto-merge (squash) May 19, 2025 15:28
EdwardAngert and others added 2 commits May 19, 2025 17:00
Co-authored-by: Steven Masley <Emyrk@users.noreply.github.com>
@stirby stirby merged commit 1314dbd into main May 19, 2025
33 checks passed
@stirby stirby deleted the 17622-dyn-param branch May 19, 2025 21:23
@github-actions github-actions bot locked and limited conversation to collaborators May 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docs Area: coder.com/docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: early access documentation for dynamic parameters feature
3 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy