Skip to main content
The checkbox component allows you to interact with a boolean value.

Basic Usage

use Filament\Forms\Components\Checkbox;

Checkbox::make('is_admin')

Available Methods

inline
method
Controls the label position (inline or stacked).
// Inline (default) - label adjacent to checkbox
Checkbox::make('is_admin')
    ->inline()

// Stacked - label above checkbox
Checkbox::make('is_admin')
    ->inline(false)
accepted
method
Requires the checkbox to be checked.
Checkbox::make('terms_of_service')
    ->accepted()
declined
method
Requires the checkbox to be unchecked.
Checkbox::make('is_under_18')
    ->declined()

Common Patterns

Terms of Service

Checkbox::make('terms_accepted')
    ->label('I accept the terms of service')
    ->accepted()
    ->validationMessages([
        'accepted' => 'You must accept the terms of service.',
    ])

Boolean Flag

Checkbox::make('is_admin')
    ->label('Administrator')
    ->default(false)

Inline Checkbox

Checkbox::make('subscribe_newsletter')
    ->label('Subscribe to newsletter')
    ->inline()

Database Casting

When saving boolean values with Eloquent, add a boolean cast:
use Illuminate\Database\Eloquent\Model;

class User extends Model
{
    protected function casts(): array
    {
        return [
            'is_admin' => 'boolean',
        ];
    }
}

Build docs developers (and LLMs) love