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 repeater component allows you to create a repeatable set of form fields.
Basic Usage
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
Repeater::make('members')
->schema([
TextInput::make('name')->required(),
Select::make('role')
->options([
'member' => 'Member',
'admin' => 'Admin',
])
->required(),
])
Available Methods
Defines the repeatable fields.Repeater::make('items')
->schema([
TextInput::make('title'),
Textarea::make('description'),
])
Sets number of default empty items.Repeater::make('members')
->schema([...])
->defaultItems(3)
Customizes the add button label.Repeater::make('members')
->schema([...])
->addActionLabel('Add member')
Controls whether items can be added.Repeater::make('items')
->schema([...])
->addable(false)
Controls whether items can be deleted.Repeater::make('items')
->schema([...])
->deletable(false)
Controls whether items can be reordered.Repeater::make('items')
->schema([...])
->reorderable(false)
Enables reordering with up/down buttons.Repeater::make('items')
->schema([...])
->reorderableWithButtons()
reorderableWithDragAndDrop
Controls drag-and-drop reordering.Repeater::make('items')
->schema([...])
->reorderableWithDragAndDrop(false)
Makes items collapsible.Repeater::make('items')
->schema([...])
->collapsible()
Makes items collapsed by default.Repeater::make('items')
->schema([...])
->collapsible()
->collapsed()
Allows cloning items.Repeater::make('items')
->schema([...])
->cloneable()
Customizes item labels.Repeater::make('items')
->schema([...])
->itemLabel(fn (array $state): ?string => $state['title'] ?? null)
Removes item containers for simple layouts.Repeater::make('links')
->simple(
TextInput::make('url')
)
Sets minimum number of items.Repeater::make('items')
->schema([...])
->minItems(2)
Sets maximum number of items.Repeater::make('items')
->schema([...])
->maxItems(10)
Sets grid columns for fields.Repeater::make('members')
->schema([...])
->columns(2)
Sets grid columns for repeater items.Repeater::make('items')
->schema([...])
->grid(2)
Configures HasMany relationship.Repeater::make('phoneNumbers')
->relationship()
->schema([
TextInput::make('number')->required(),
Select::make('type')->options(['mobile' => 'Mobile', 'home' => 'Home']),
])
Common Patterns
Repeater::make('contacts')
->schema([
TextInput::make('name')
->required(),
TextInput::make('email')
->email()
->required(),
TextInput::make('phone')
->tel(),
])
->columns(3)
->defaultItems(1)
->collapsible()
Simple List
Repeater::make('links')
->simple(
TextInput::make('url')->url()
)
->minItems(1)
->maxItems(5)
Product Variants
Repeater::make('variants')
->schema([
TextInput::make('name')->required(),
TextInput::make('sku')->required(),
TextInput::make('price')
->numeric()
->prefix('$')
->required(),
TextInput::make('stock')
->numeric()
->default(0),
])
->columns(2)
->collapsible()
->itemLabel(fn (array $state): ?string => $state['name'] ?? null)
->cloneable()
FAQ Items
Repeater::make('faqs')
->schema([
TextInput::make('question')->required(),
Textarea::make('answer')->required(),
])
->itemLabel(fn (array $state): ?string => $state['question'] ?? null)
->collapsible()
->reorderableWithButtons()
->addActionLabel('Add FAQ')
Database Casting
Add an array cast when storing as JSON:
use Illuminate\Database\Eloquent\Model;
class Product extends Model
{
protected function casts(): array
{
return [
'members' => 'array',
];
}
}