Input Fields

A focused collection of input fields optimized for data entry and user information capture with advanced validation, autocomplete support, and comprehensive field types. Perfect for building registration forms, profile editors, and data collection interfaces.

Example

User Registration Fields

Must be 3-20 alphanumeric characters

We'll use this for account notifications

Must be at least 8 characters long

Must be between 1-150

Interactive Demo

Use natural language to generate and modify input fields in real time. This interactive demo runs inside the showcase's app-level TamboProvider, which sets a per-user context key (persisted in localStorage).

AI-Generated Input Fields

Tambo Conversations

Installation

$
npx tambo add input-fields

Try It Yourself

1. Install the component

npx tambo add input-fields

2. Register with Tambo

tsx
import {
  InputFields,
  inputFieldsSchema,
} from "@/components/tambo/input-fields";
import { MessageThreadFull } from "@/components/tambo/message-thread-full";
import { useTambo } from "@tambo-ai/react";
import { useEffect } from "react";

export function App() {
  const { registerComponent } = useTambo();

  useEffect(() => {
    registerComponent({
      name: "InputFields",
      description: "A focused collection of input fields.",
      component: InputFields,
      propsSchema: inputFieldsSchema,
    });
  }, [registerComponent]);

  return <MessageThreadFull />;
}

3. Send a prompt

Try these example prompts:

  • → "Create sign-up fields with email and password validation"
  • → "Add a phone field with pattern validation and helper text"
  • → "Build a profile editor with username, email, and age inputs"

Component API

InputFields

PropTypeDefaultDescription
fieldsInputField[][]Array of input field configurations
variant"default" | "solid" | "bordered""default"Visual style of the container
layout"default" | "compact" | "relaxed""default"Spacing between input fields
classNamestring-Additional CSS classes for customization

InputField

PropTypeDefaultDescription
idstring-Unique identifier for the field
type"text" | "email" | "password" | "number"-Type of input field to render
labelstring-Label text displayed above the field
placeholderstring-Placeholder text shown in empty fields
requiredbooleanfalseWhether the field is required
disabledbooleanfalseWhether the field is disabled
descriptionstring-Helper text displayed below the field
minLengthnumber-Minimum character length for validation
maxLengthnumber-Maximum character length for validation
patternstring-Regular expression pattern for validation
autoCompletestring-Autocomplete attribute for browser support
errorstring-Error message displayed below the field