Skip to main content
← Back to Table of Contents

Summary

Modern boolean toggle designed for settings pages and feature flags. Unlike the native Filament toggle, SwitchField supports description text, status badges, and two distinct layouts: a compact row and a bordered card.

Basic usage

Simple row toggle

Bordered card with badge


State & validation

Stored value

The field stores a boolean true or false. It defaults to false in setUp().

Validation rules

Built-in validation ensures the value is a boolean. You can use standard Filament/Laravel rules:

Layouts & Positioning

Layout: Row (default)

Label and description on the left, toggle on the right. Best for dense settings lists.

Layout: Card

Adds a border and padding around the entire field. Ideal for highlighting important options.

Label position

Move the toggle to the start (left) or end (right) of the row.

Configuration API

All methods accept Closure unless noted.

Real-world examples

Terms of Service (Wizard)

Compact Settings List


Playground

/admin/flex-fields-playground/switch See Playground for setup.

CSS classes (reference)