Documentation Index
Fetch the complete documentation index at: https://mintlify.com/filamentphp/filament/llms.txt
Use this file to discover all available pages before exploring further.
The checkbox component allows you to interact with a boolean value.
Basic Usage
use Filament\Forms\Components\Checkbox;
Checkbox::make('is_admin')
Available Methods
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)
Requires the checkbox to be checked.Checkbox::make('terms_of_service')
->accepted()
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',
];
}
}