Skip to content

Commit

Permalink
add example of templating scaffolder fields in select box
Browse files Browse the repository at this point in the history
  • Loading branch information
punkle committed Sep 12, 2023
1 parent ac018b9 commit 1c8034f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions content/docs/scaffolder/writing-templates/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,39 @@ parameters:
labelSelector: 'value'
```
Some of the `SelectFieldFromApi` options allow using parameters from earlier parameter pages to be used to template the options. The templated options are `params`, `path`, `valueSelector` and `labelSelector`. e.g.

```yaml
parameters:
- title: Select an Entity kind
required:
- kind
properties:
kind:
title: Kind
type: string
enum:
- template
- location
default: template
ui:autofocus: true
ui:options:
rows: 5
- title: Select the specific entity you want
properties:
obj:
title: custom
type: string
description: Entity Selector
ui:field: SelectFieldFromApi
ui:options:
path: "catalog/entities"
params:
filter: "kind={{ parameters.kind }}"
valueSelector: "metadata.name"
labelSelector: "metadata.description"
```

### `number`

You can allow the user to enter a number using the `number` type:
Expand Down

0 comments on commit 1c8034f

Please sign in to comment.