Skip to content

feat: enum (dropdown selection) type for forms/prompts#893

Draft
cmorman89 wants to merge 5 commits intomainfrom
feat-enum-type-main
Draft

feat: enum (dropdown selection) type for forms/prompts#893
cmorman89 wants to merge 5 commits intomainfrom
feat-enum-type-main

Conversation

@cmorman89
Copy link
Contributor

@cmorman89 cmorman89 commented Feb 9, 2026

Targets main

Adds enum/enum[] types with validation to allow selecting predefined options from a dropdown

RFC: Enum/Dropdown Support for Schema Properties

Summary

This PR adds native enum (dropdown) support to the schema editor and form rendering system, enabling users to define constrained value sets for prompt and interaction parameters.

Motivation

Currently, users who need to limit input values to a predefined set must rely on validation rules or free-text input with instructions. Native enum support provides:

  • Better UX with dropdown selection instead of free text
  • Built-in validation (only allowed values can be selected)
  • Support for both single-select and multi-select scenarios

Changes

New Components

File Purpose
EnumInput.tsx Single and multi-select dropdown components using SelectBox
EnumValuesDialog.tsx Modal for defining enum values in the schema editor

Modified Components

File Change
ManagedObject.ts Detects enum input type; routes enum arrays to ManagedProperty (multi-select scalar)
Form.tsx Routes enum and enum[] types to the new dropdown components via ScalarField
PropertyEditor.tsx Adds settings button to configure enum values when type is enum
EditableSchemaProperty.tsx Exposes enumValues from SchemaNode for the editor
json-schema4-utils.ts Handles enum type signature detection and schema updates
ManagedSchema.ts Stores and propagates enumValues through the schema management layer
type-signature.ts Adds enum to the TypeNames enum

User Experience

Schema Editor:

  1. Select "enum" or "enum[]" from the type dropdown
  2. Click the gear icon to open the enum values dialog
  3. Add/remove values, press Enter to add quickly
  4. Save to persist values

Form Rendering:

  • enum → single-select dropdown with clear option
  • enum[] → multi-select dropdown

Technical Details

  • Enum values stored in JSON Schema's standard enum field
  • For arrays, enum values are stored in items.enum
  • Underlying type is string (compatible with JSON Schema spec)
  • Null support via standard [type, "null"] pattern

Scope

This is a basic implementation covering:

  • String enums (most common use case)
  • Single and multi-select
  • Schema editor UI
  • Form rendering

Screenshots

Prompts:

image image

Agent Runner:

image image

@cmorman89 cmorman89 self-assigned this Feb 9, 2026
@cmorman89 cmorman89 changed the title feat: enum (dropdown selection) type for forms feat: enum (dropdown selection) type for forms/prompts Feb 9, 2026
@cmorman89 cmorman89 added the enhancement New feature or request label Feb 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant