Skip to content
Author with AI

<Inputs>

The <Inputs> block renders a form to collect user input. Other blocks use the collected values through their inputsId prop: Command, Check and Finish blocks in their scripts, Template and TemplateInline blocks in their templates, and most other blocks in their props.

<Inputs id="config">
```yaml
variables:
- name: ProjectName
type: string
description: Name of your project
validations:
- required
```
</Inputs>

Inputs and Template both render forms to collect variable values:

Feature <Inputs> <Template>
Collects variables Yes Yes
Generates files No Yes
Button text “Submit” “Generate”
Use case Collect values for other blocks Generate files from a Boilerplate template directory
  • id (string). Unique identifier for this component. Other blocks reference this ID via inputsId to access the collected values.
  • path (string). Path to a directory containing a boilerplate.yml (or boilerplate.yaml) file, or to the file itself, relative to the runbook. Required unless the block has inline YAML. Runbook tests only read a file named boilerplate.yml.
  • prefilledVariables (object). An object of variable names to values that pre-populate the form fields. These values override any default values defined in the YAML.

Variables use the Boilerplate variable syntax. Declare them as inline YAML or load them with path. A block takes one or the other. A dropdown’s options can have labels, or come from a block’s output, such as a list of regions a <Command> looked up.

Write the variable definitions inside the <Inputs> tags in the style of a boilerplate.yml file, wrapped in a ```yaml code fence:

<Inputs id="user-settings">
```yaml
variables:
- name: Username
type: string
description: Your username
validations:
- required
- name: NotifyByEmail
type: bool
description: Receive email notifications
default: true
```
</Inputs>

The code fence is required. Without it, MDX parses the YAML as Markdown paragraphs and lists and loses its indentation, so the block shows an “Invalid inline boilerplate configuration format” error asking you to wrap the YAML in a code fence.

A description can use markdown, such as bold, links and lists. Write a multi-line one as a YAML block scalar:

<Inputs id="platform">
```yaml
variables:
- name: SubscriptionLayout
type: enum
options: [single, caf]
description: |
How many subscriptions the platform uses:
- **single**: one subscription for everything.
- **caf**: four subscriptions, as Microsoft's [Cloud Adoption Framework](https://learn.microsoft.com/azure/cloud-adoption-framework/ready/landing-zone/) recommends.
```
</Inputs>

See Field descriptions for what renders.

Load variables from an external boilerplate.yml file:

<Inputs id="vpc-config" path="templates/vpc" />

This loads variable definitions from templates/vpc/boilerplate.yml relative to your runbook file.

Pre-populate form fields with specific values. These override any default values, and are what a field’s Reset button puts back:

<Inputs
id="aws-config"
path="templates/aws-settings"
prefilledVariables={{
AwsRegion: "us-west-2",
Environment: "production"
}}
/>

prefilledVariables also sets locked and hidden fields, which the user can’t change. A runbook that loads a shared boilerplate.yml can use it to set their values for itself.

Until the user first clicks Submit, other blocks get the values the form started with, such as each variable’s default, not what the user has typed. Once the form has been submitted, other blocks get each change as the user makes it, without another Submit. An Inputs block embedded in a Command or Check submits itself, so its parent always gets the current values.

Command, Check, Finish, Template and TemplateInline blocks read the values of an Inputs block through inputsId. A Command or Check whose script or env references {{ .inputs.X }} needs inputsId or an embedded Inputs block. Without one, the block shows only a “Configuration Required” warning and can’t run.

<Inputs id="vpc-config">
```yaml
variables:
- name: VpcName
type: string
description: Name for the VPC
- name: CidrBlock
type: string
description: CIDR block for the VPC
default: "10.0.0.0/16"
```
</Inputs>
<Command
id="create-vpc"
env={{ CIDR_BLOCK: "{{ .inputs.CidrBlock }}", VPC_NAME: "{{ .inputs.VpcName }}" }}
command='aws ec2 create-vpc --cidr-block "$CIDR_BLOCK" --tag-specifications "ResourceType=vpc,Tags=[{Key=Name,Value=$VPC_NAME}]"'
inputsId="vpc-config"
title="Create VPC"
successMessage="VPC {{ .inputs.VpcName }} created!"
/>

You can reference multiple Inputs blocks by passing an array of IDs. Variables are merged in order, with later IDs overriding earlier ones:

<Inputs id="global-config">
```yaml
variables:
- name: Environment
type: enum
options: [dev, staging, prod]
default: dev
```
</Inputs>
<Inputs id="app-config">
```yaml
variables:
- name: AppName
type: string
- name: Port
type: int
default: 8080
```
</Inputs>
<Command
id="deploy"
path="scripts/deploy.sh"
inputsId={["global-config", "app-config"]}
env={{
ENVIRONMENT: "{{ .inputs.Environment }}",
APP_NAME: "{{ .inputs.AppName }}",
PORT: "{{ .inputs.Port }}",
}}
title="Deploy Application"
/>

You can embed Inputs directly inside a Command or Check block:

<Command
id="greet"
env={{ NAME: "{{ .inputs.Name }}" }}
command='echo "Hello, $NAME!"'
title="Say Hello"
>
<Inputs id="greeting-inputs">
```yaml
variables:
- name: Name
type: string
description: Your name
validations:
- required
```
</Inputs>
</Command>

When embedded, the Inputs form renders inline within the parent block without a separate submit button, and the parent can use its variables.

Other blocks can still reference embedded Inputs using the standard inputsId pattern.

Group related variables under section headers using the x-section extension:

variables:
- name: FunctionName
type: string
description: Name of the Lambda function
x-section: Basic Configuration
- name: Runtime
type: enum
options: [python3.12, nodejs20.x]
x-section: Basic Configuration
- name: MemorySize
type: int
description: Memory allocation in MB
default: 128
x-section: Advanced Settings
- name: Timeout
type: int
description: Timeout in seconds
default: 30
x-section: Advanced Settings

Variables with the same x-section value are grouped together in the form under a section header.

The same YAML can also lay the form out further. order places fields, x-sections folds sections, and x-locked and x-hidden show a field read-only or leave it out, for values the runbook sets itself.

# Create a GitHub Repository
Enter your repository settings:
<Inputs id="repo-settings">
```yaml
variables:
- name: OrgName
type: string
description: GitHub organization name
validations:
- required
- name: RepoName
type: string
description: Repository name
validations:
- required
- name: Visibility
type: enum
description: Repository visibility
options:
- private
- public
default: private
```
</Inputs>
First, verify you're authenticated to GitHub:
<Check
id="check-auth"
command="gh auth status"
title="Verify GitHub Authentication"
successMessage="Authenticated to GitHub!"
failMessage="Not authenticated. Run 'gh auth login' first."
/>
Now create the repository:
<Command
id="create-repo"
env={{
ORG: "{{ .inputs.OrgName }}",
REPO: "{{ .inputs.RepoName }}",
VISIBILITY: "{{ .inputs.Visibility }}",
}}
command='gh repo create "$ORG/$REPO" "--$VISIBILITY"'
inputsId="repo-settings"
title="Create Repository"
successMessage="Repository {{ .inputs.OrgName }}/{{ .inputs.RepoName }} created!"
failMessage="Failed to create repository"
/>
Verify the repository was created:
<Check
id="verify-repo"
env={{ ORG: "{{ .inputs.OrgName }}", REPO: "{{ .inputs.RepoName }}" }}
command='gh repo view "$ORG/$REPO"'
inputsId="repo-settings"
title="Verify Repository Exists"
successMessage="Repository verified!"
/>