Skip to main content
Flux provides a complete set of form input components with built-in validation, error handling, and seamless Livewire integration.

Input

The primary text input component with extensive features:

Basic Usage

<flux:input wire:model="name" placeholder="Enter your name" />

Input Types

<flux:input type="text" placeholder="Text" />
<flux:input type="email" placeholder="Email" />
<flux:input type="password" placeholder="Password" />
<flux:input type="number" placeholder="Number" />
<flux:input type="date" />
<flux:input type="time" />
<flux:input type="url" placeholder="https://" />
<flux:input type="tel" placeholder="Phone" />
<flux:input type="search" placeholder="Search..." />

With Icons

<!-- Leading icon -->
<flux:input icon="magnifying-glass" placeholder="Search..." />
<flux:input icon:leading="envelope" type="email" />

<!-- Trailing icon -->
<flux:input icon:trailing="information-circle" />

Sizes

<flux:input size="xs" placeholder="Extra small" />
<flux:input size="sm" placeholder="Small" />
<flux:input size="base" placeholder="Base (default)" />

Variants

<flux:input variant="outline" placeholder="Outlined input" />
Default variant with visible border.

Input Features

Clearable

Add a clear button:
<flux:input wire:model="search" clearable placeholder="Search..." />

Copyable

Add a copy-to-clipboard button:
<flux:input value="secret-token-123" copyable readonly />

Viewable

Toggle password visibility:
<flux:input type="password" viewable placeholder="Password" />

Expandable

Expand to textarea on click:
<flux:input wire:model="description" expandable placeholder="Add description..." />

Loading State

<flux:input wire:model.live="search" loading placeholder="Search..." />

Input Masking

Format input values:
<!-- Phone number -->
<flux:input mask="(999) 999-9999" placeholder="Phone" />

<!-- Credit card -->
<flux:input mask="9999 9999 9999 9999" placeholder="Card number" />

<!-- Date -->
<flux:input mask="99/99/9999" placeholder="MM/DD/YYYY" />

<!-- Dynamic masking -->
<flux:input mask:dynamic="$money($input)" placeholder="Amount" />

Input Props

PropTypeDefaultDescription
typestringtextInput type
variantstringoutlineVisual variant: outline, filled
sizestringbaseSize: xs, sm, base
iconstring-Leading icon name
icon:leadingstring-Leading icon (alternative)
icon:trailingstring-Trailing icon name
clearablebooleanfalseShow clear button
copyablebooleanfalseShow copy button
viewablebooleanfalseShow view toggle (password)
expandablebooleanfalseExpand to textarea
loadingbooleanautoShow loading indicator
maskstring-Input mask pattern
mask:dynamicstring-Dynamic mask expression
invalidbooleanautoForce invalid state

Textarea

Multi-line text input:

Basic Usage

<flux:textarea wire:model="description" placeholder="Enter description..." />

Rows

<flux:textarea rows="3" placeholder="3 rows" />
<flux:textarea rows="6" placeholder="6 rows" />

<!-- Auto-resize based on content -->
<flux:textarea rows="auto" placeholder="Auto-resize" />

Resize Behavior

<flux:textarea resize="vertical" placeholder="Vertical resize" />
<flux:textarea resize="horizontal" placeholder="Horizontal resize" />
<flux:textarea resize="both" placeholder="Both directions" />
<flux:textarea resize="none" placeholder="No resize" />

Select

Native select dropdown with custom styling:

Basic Usage

<flux:select wire:model="country">
    <option value="">Select a country</option>
    <option value="us">United States</option>
    <option value="ca">Canada</option>
    <option value="mx">Mexico</option>
</flux:select>

With Groups

<flux:select wire:model="category">
    <optgroup label="Fruits">
        <option value="apple">Apple</option>
        <option value="banana">Banana</option>
    </optgroup>
    <optgroup label="Vegetables">
        <option value="carrot">Carrot</option>
        <option value="lettuce">Lettuce</option>
    </optgroup>
</flux:select>

Checkbox

Checkbox inputs with multiple variants:

Basic Usage

<flux:checkbox wire:model="accepted">
    I accept the terms
</flux:checkbox>

Variants

<flux:checkbox wire:model="option1">Option 1</flux:checkbox>
<flux:checkbox wire:model="option2">Option 2</flux:checkbox>
Standard checkbox appearance.

Checkbox Group

<flux:checkbox.group wire:model="interests">
    <flux:checkbox value="sports">Sports</flux:checkbox>
    <flux:checkbox value="music">Music</flux:checkbox>
    <flux:checkbox value="travel">Travel</flux:checkbox>
</flux:checkbox.group>

Radio

Radio button inputs with multiple variants:

Basic Usage

<flux:radio.group wire:model="plan">
    <flux:radio value="free">Free</flux:radio>
    <flux:radio value="pro">Pro</flux:radio>
    <flux:radio value="enterprise">Enterprise</flux:radio>
</flux:radio.group>

Variants

<flux:radio.group wire:model="size">
    <flux:radio value="sm">Small</flux:radio>
    <flux:radio value="md">Medium</flux:radio>
    <flux:radio value="lg">Large</flux:radio>
</flux:radio.group>

Switch

Toggle switch for boolean values:
<flux:switch wire:model="notifications">
    Enable notifications
</flux:switch>

<flux:switch wire:model="darkMode">
    Dark mode
</flux:switch>

Field

Wrapper component for form inputs with labels, descriptions, and errors:

Basic Usage

<flux:field>
    <flux:label>Email Address</flux:label>
    <flux:input type="email" wire:model="email" />
    <flux:error name="email" />
</flux:field>

With Description

<flux:field>
    <flux:label>Username</flux:label>
    <flux:description>Choose a unique username for your profile.</flux:description>
    <flux:input wire:model="username" />
    <flux:error name="username" />
</flux:field>

Field Components

Label

<flux:label>Full Name</flux:label>
<flux:label required>Email (required)</flux:label>

Description

<flux:description>Helpful context about this field.</flux:description>

Error

<flux:error name="email" />
Automatically displays validation errors from Livewire.

Fieldset

Group related form fields:
<flux:fieldset>
    <flux:legend>Personal Information</flux:legend>
    
    <flux:field>
        <flux:label>First Name</flux:label>
        <flux:input wire:model="firstName" />
    </flux:field>
    
    <flux:field>
        <flux:label>Last Name</flux:label>
        <flux:input wire:model="lastName" />
    </flux:field>
</flux:fieldset>

Validation

All form components automatically integrate with Laravel validation:
<flux:field>
    <flux:label>Email</flux:label>
    <flux:input type="email" wire:model="email" />
    <flux:error name="email" />
</flux:field>
Inputs automatically show error state when validation fails:
class ContactForm extends Component
{
    public $email = '';
    
    protected $rules = [
        'email' => 'required|email',
    ];
    
    public function submit()
    {
        $this->validate();
        // ...
    }
}

OTP

One-Time Password (OTP) input component for verification codes and authentication.

Basic Usage

<flux:otp wire:model="code" length="6" />

Private Mode

Hide the entered digits for security:
<flux:otp wire:model="code" length="6" private />

Custom Length

<flux:otp wire:model="code" length="4" />
<flux:otp wire:model="code" length="8" />

With Field Wrapper

<flux:field>
    <flux:label>Enter verification code</flux:label>
    <flux:otp wire:model="code" length="6" />
    <flux:error name="code" />
</flux:field>

Props

PropTypeDefaultDescription
lengthintnullNumber of input boxes
privateboolfalseHide entered digits
wire:modelstring-Livewire property binding

Avatar

Display user avatars with initials, images, or icons.

Basic Usage

<flux:avatar name="John Doe" />
<flux:avatar src="/path/to/image.jpg" alt="John Doe" />
<flux:avatar icon="user" />

Sizes

<flux:avatar name="John Doe" size="xs" />
<flux:avatar name="John Doe" size="sm" />
<flux:avatar name="John Doe" size="md" />
<flux:avatar name="John Doe" size="lg" />
<flux:avatar name="John Doe" size="xl" />

Colors

<flux:avatar name="John Doe" color="auto" />
<flux:avatar name="John Doe" color="blue" />
<flux:avatar name="John Doe" color="red" />
<flux:avatar name="John Doe" color="green" />

Circle Shape

<flux:avatar name="John Doe" circle />

With Badge

<flux:avatar name="John Doe" badge="3" />
<flux:avatar name="John Doe" badge badge:color="green" />
<flux:avatar name="John Doe">
    <flux:badge slot="badge" color="red" circle />
</flux:avatar>

With Tooltip

<flux:avatar name="John Doe" tooltip />
<flux:avatar name="John Doe" tooltip="Profile picture" />

Avatar Group

Display multiple avatars in a group:
<flux:avatar.group>
    <flux:avatar name="John Doe" />
    <flux:avatar name="Jane Smith" />
    <flux:avatar name="Bob Johnson" />
</flux:avatar.group>

Props

PropTypeDefaultDescription
namestringnullName for initials generation
srcstringnullImage source URL
iconstringnullIcon name from Heroicons
initialsstringnullCustom initials override
sizestring'md'Size: xs, sm, md, lg, xl
colorstringnullColor: auto or any Tailwind color
circleboolfalseCircular shape
badgestring|slotnullBadge content or slot
tooltipstring|boolnullTooltip text
hrefstringnullMake avatar clickable

Accessibility

  • All inputs include proper name attributes
  • Labels are associated with inputs
  • Error messages use aria-invalid and proper ARIA attributes
  • Keyboard navigation works as expected
  • Required fields can be marked visually
  • OTP inputs include proper ARIA labels for screen readers
  • Avatars include proper alt text when using images
Form components automatically extract the field name from wire:model for validation and error handling.