Form

A dynamic form builder component that creates structured forms with multiple input types, validation, and flexible layouts. Perfect for generating contact forms, surveys, and data collection interfaces.

Examples

This interactive demo runs inside the showcase's app-level TamboProvider, which sets a per-user context key (persisted in localStorage).

Contact Form

Tambo Conversations

Loading threads...

Installation

$
npx tambo add form

Component API

Form

PropTypeDefaultDescription
fieldsFormField[]-Array of form field configurations
onSubmit(data: Record<string, any>) => void-Callback function when form is submitted
onErrorstring-Optional error message to display
submitTextstring"Submit"Text to display on the submit button
variant"default" | "solid" | "bordered""default"Visual style of the form container
layout"default" | "compact" | "relaxed""default"Spacing between form fields
classNamestring-Additional CSS classes for customization

FormField

PropTypeDefaultDescription
idstring-Unique identifier for the field
type"text" | "email" | "number" | "select" | "textarea" | "radio" | "checkbox" | "slider" | "yes-no"-Type of input field to render
labelstring-Label text displayed above the field
placeholderstring-Placeholder text shown in empty fields
optionsstring[]-Options for select, radio, and checkbox fields
requiredbooleanfalseWhether the field is required
descriptionstring-Helper text displayed below the field