Skip to main content
Form cells provide interactive form inputs that collect user input and make it available to subsequent cells. Use the SpinForms class to create form elements like checkboxes, text boxes, dropdowns, and connection selectors. Form cell screenshot

When to Use Form Cells

Use form cells when input values will be used by subsequent cells. Form cells create reusable inputs that later cells can reference. This is ideal for notebooks where users configure settings upfront (e.g., selecting an environment, entering a service name) that affect multiple downstream operations. Use @param syntax in Python cells when you need to parameterize a single cell’s behavior. The @param values are scoped to that one cell and are best for cell-specific configuration that doesn’t need to be shared.

Important Notes

  • Re-execution: Form cells automatically re-run when a session starts, when any cell before the form finishes running, or when the user interacts with any form input.
  • Performance: Because form cells re-run frequently, avoid expensive operations like API calls or database queries directly in form cells. Instead, perform data fetching in Python cells before the form cell and reference the results using CellResult.get_from_cell().
  • Variable naming: The form input id should be a valid Python variable name and should match the variable you assign the return value to.
  • Form-only usage: SpinForms functions can only be used in form cells, not in regular Python cells. Use the @param syntax for Python cell parameters.

Available Input Types

Checkbox

Returns a boolean value.

Textbox

Returns a string value.
Returns the selected string value.

Static Options

Provide a list of strings for simple dropdown options:

Options with Display Labels

Use a dictionary to show different labels than the underlying values:

Dynamic Options from Previous Cells

Populate dropdown options from the output of a previous cell: Initial shell cell (id=get_context_list) to get a list of kubectl context names, delimited by newline
Form cell asking the user to select a valid context name

Multi-Select Dropdown

Enable multiple selections by setting multi=True. Returns a list of selected values instead of a single string.
With display labels:

Connections

Returns the selected connection name. Useful for letting users select from configured integrations.

Secrets

Returns the selected secret name. Use this when you want users to choose which credential to use at runtime.

Using the Selected Secret in Subsequent Cells

Since the secrets form returns the name of the secret (not the value), use {{secret_var:variable_name}} in non-Python cells to retrieve the actual secret value: Form Cell:
Shell Cell:
Python Cell:
Use {{secret:SECRET_NAME}} when the secret name is static. Use {{secret_var:variable_name}} when the secret name is stored in a variable (e.g., from a form dropdown).

Time Range

Returns a tuple of two Python datetime objects representing the earliest and latest times in the range.

Time Expression Syntax

The time range picker supports various time expressions:

Using Time Range Values

The returned datetime objects can be used directly with time-based APIs:

Validation

Validate form inputs by raising SpinForms.ValidationError. The error message will be displayed next to the corresponding form input.

Conditional Validation

Using Form Values in Subsequent Cells

Form cell variables are available to all subsequent cells in the notebook.

In Python Cells

Reference form variables directly by their ID:

In Non-Python Cells

Use the {{variable_name}} template syntax to reference form values in REST cells, LLM cells, Shell cells, and integration cells: REST Cell:
Shell Cell:
LLM Cell:

Dependent Form Elements

Form cells can reference results from previous cells to create dynamic forms.

Example: Cascading Dropdowns

Cell 1 (Python): Fetch available regions
Cell 2 (Python): Fetch clusters for selected region
Cell 3 (Form): Let user select region, then cluster

Example: Conditional Form Inputs

Complete Example

This example shows a complete deployment configuration form: Cell 1 (Python): Fetch available environments
Cell 2 (Python): Fetch services for the workspace
Cell 3 (Form): Deployment configuration
Cell 4 (Shell): Execute deployment