juanborras's avatar

Filament form tabs with repeaters

Hey there!

I have a huge repeater. Is it possible to split the repeater into tabs?

Thanks!

0 likes
1 reply
LaryAI's avatar
Level 58

To split a repeater into tabs using Filament, you can utilize the Tabs component within the repeater fields. Here's a basic example of how you can achieve this:

use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Tabs;
use Filament\Forms\Components\TextInput;

Repeater::make('items')
    ->schema([
        Tabs::make('Item Details')
            ->tabs([
                Tabs\Tab::make('General')
                    ->schema([
                        TextInput::make('name')
                            ->label('Name')
                            ->required(),
                        TextInput::make('description')
                            ->label('Description'),
                    ]),
                Tabs\Tab::make('Additional')
                    ->schema([
                        TextInput::make('extra_info')
                            ->label('Extra Info'),
                        TextInput::make('notes')
                            ->label('Notes'),
                    ]),
            ]),
    ])
    ->minItems(1)
    ->maxItems(10)
    ->columns(1),

In this example, the Repeater component is used to create a list of items, and within each item, the Tabs component is used to organize fields into different tabs. You can customize the fields and tabs according to your needs. This setup allows you to manage a large number of fields within a repeater by categorizing them into tabs, making the form more organized and user-friendly.

Please or to participate in this conversation.