BuzzForm
BuzzFormDocs

Text Field

Single-line text input with optional validation and copy functionality.

Text Field

The text field renders a single-line text input.

Schema Properties

Prop

Type

UI Options

OptionTypeDefaultDescription
copyablebooleanfalseShow copy button
autoFocusbooleanfalseAuto-focus the input on mount
classNamestring-CSS class applied to the field container
widthstring | number-Inline width applied to the field

Basic Usage

const schema = defineSchema({
  fields: [
    {
      type: "text",
      name: "username",
      label: "Username",
      required: true,
      minLength: 3,
      maxLength: 20,
      placeholder: "Enter username",
    },
  ],
});

Examples

With Validation

{
  type: "text",
  name: "slug",
  label: "URL Slug",
  required: true,
  minLength: 3,
  maxLength: 50,
  pattern: /^[a-z0-9-]+$/,
  placeholder: "my-page-slug",
}

Copyable Input

{
  type: "text",
  name: "apiKey",
  label: "API Key",
  readOnly: true,
  defaultValue: "sk_live_abc123",
  ui: { copyable: true },
}

Auto-Focus

{
  type: "text",
  name: "search",
  label: "Search",
  ui: { autoFocus: true },
}

With Description

{
  type: "text",
  name: "displayName",
  label: "Display Name",
  description: "This will be shown publicly on your profile",
  placeholder: "John Doe",
}

Auto-Derived Validators

PropertyValidator
required: truerequired
minLengthminLength
maxLengthmaxLength
patternpattern

On this page