Pittaya UI
Pittaya UI
Links

Search Components

Search for components by name, description, category or tags

Formsstable

Input

A versatile and accessible input field with multiple variants including floating labels and outlined styles for modern form interfaces.

Subscribe
Join our newsletter for weekly updates.

Installation

Install the component directly into your project using the Pittaya CLI.

npx pittaya@latest add input

When to use

Use the Input component when you need to collect textual data from users. It's ideal for forms, search interfaces, and any scenario where users need to enter information like names, emails, passwords, or other text-based data.

The component offers multiple variants to match different design patterns: floating labels for modern interfaces, outlined style for Material Design aesthetics, and traditional inputs for classic forms.

Best practices

  • Always provide descriptive labels for accessibility, using the label prop for floating/outlined variants or the Label component for default inputs.
  • Use appropriate type attributes (email, password, number) to enable browser validation and mobile keyboard optimization.
  • Provide helpful placeholders that exemplify the expected format, but don't rely on them as the only form of instruction.
  • Validate data on both client and server sides for better UX and security.
  • Choose the variant that best fits your design system: floating for modern apps, outlined for Material Design, or default for traditional forms.
  • Provide clear error messages using aria-invalid and error text when validation fails.

Accessibility

The Input component is built with accessibility in mind, following WAI-ARIA best practices for form controls.

  • Always associate inputs with labels using the label prop or htmlFor attributes.
  • The component automatically handles aria-invalid states with visual feedback through ring colors.
  • Floating and outlined variants maintain label visibility at all times, improving accessibility for users with cognitive disabilities.
  • The component supports disabled state with proper styling and cursor behavior.
  • Focus states are clearly visible with ring indicators for keyboard navigation users.

Variants

The Input component offers four distinct variants:

  • Default - Standard input field with traditional styling, best paired with an external Label component.
  • Floating - Label starts inside the input and animates to float above the border when focused or filled. Creates a modern, space-efficient design.
  • Floating Inside - Label starts centered in the input and animates to the top-left corner when focused or filled, remaining within the input boundaries.
  • Outlined - Material Design style with the label positioned on the border, creating a clean outlined appearance. Label animates from inside to the border on focus/fill.

Examples

Combine variants and sizes to meet your needs.

Default input

Standard input field with traditional styling, best used with an external Label component.

Subscribe
Join our newsletter for weekly updates.

Floating label

Label starts inside the input and floats above the border when focused or filled, creating a modern space-efficient design.

Login
Welcome back! Please sign in to continue.

Floating label inside

Label animates from center to top-left corner, remaining within the input boundaries. Perfect for compact forms.

Profile Details
Update your personal information.

Outlined input

Material Design style with label positioned on the border. Label animates from inside to the border on focus or when filled.

Payment Method
Add a new credit card securely.

Disabled state

Inputs can be disabled to prevent user interaction, with appropriate visual feedback.

Archived Project
This project is read-only and cannot be edited.

Complete form

A complete form example demonstrating different input variants working together.

Contact Sales

Fill out the form below and we'll get back to you.

Variants comparison

Visual comparison of all available input variants side by side.

Input Variants
Compare different input styles and behaviors side by side.

Default

Standard input with separate label. Best for traditional forms.

Floating

Label floats above border. Modern and space-efficient.

Floating Inside

Label stays inside input. Compact and clean.

Outlined

Label on border. Material Design inspired style.

Properties

TSX interface that combines variants and default attributes.

PropTypeDefaultDescription
variant
'default' | 'floating' | 'floatingInside' | 'outlined''default'Defines the visual style and label behavior of the input. Each variant offers unique animations and positioning.
label
stringLabel text for floating, floatingInside, and outlined variants. If not provided, falls back to the placeholder value.
type
'text' | 'email' | 'password' | 'number' | 'tel' | 'url' | ...'text'Defines the input type, controlling validation behavior and mobile keyboard type.
placeholder
stringExample text displayed when the field is empty (for default variant) or used as fallback label.
disabled
booleanfalseDisables interaction with the field and applies disabled styling.
className
stringAdditional CSS classes to customize the input appearance.