Skip to main content
When creating Speckle functions, you’ll often need users to provide configuration values. Rather than having users edit code or configuration files, the SDK can automatically generate user-friendly form inputs in the web interface.

Basic Input Types

The most common need is collecting text and numbers from users. You can create these inputs while controlling what values are valid:

Text and Numbers

Controlling User Choices with Dropdowns

Often you’ll want users to select from specific options rather than typing freely. This prevents errors and makes your function more robust. There are two ways to create dropdowns: Enums are the cleaner approach when you have a fixed set of options that won’t change often:

Using JSON Schema (Experimental)

Sometimes you need more flexibility or want to generate options dynamically. JSON schema gives you this control, but the full schema is only partially supported and may not give desired results in UI:

Protecting Sensitive Data

When your function needs sensitive information like API keys or passwords, use secret fields. These protect users by:
  • Masking the input with asterisks
  • Encrypting the values in storage
  • Only decrypting them when your function runs

Validating User Input

Help users provide correct data by adding validation rules:

Python

The SDK uses Pydantic validation:
  • gt, lt: Ensure numbers are greater/less than a value
  • ge, le: Allow numbers equal to the limit
  • min_length, max_length: Control text length
  • pattern: Match text against a regex pattern

C

Use standard .NET validation attributes:
  • [Range]: Set minimum and maximum numbers
  • [MinLength], [MaxLength]: Control text length
  • [RegularExpression]: Match text patterns
  • [Required]: Mark fields as mandatory

Field Types Comparison Table

Last modified on July 18, 2026