PHP code example of icetalker / filament-tab-repeater

1. Go to this page and download the library: Download icetalker/filament-tab-repeater library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

icetalker / filament-tab-repeater example snippets


use Icetalker\FilamentTabRepeater\Forms\Components\TabRepeater;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\RichEditor;

$languages = [
    'en' => 'English',
    'zh-CN' => '中文'
];

TabRepeater::make('translations')
    ->relationship('translations')
    ->schema([
        Select::make('language_code')
            ->label('Language')
            ->options($languages)
            ->

use App\Forms\Components\TabRepeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Support\Icons\Heroicon;

TabRepeater::make('social_links')
    ->schema([
        Select::make('platform')
            ->options([
                'github' => 'GitHub',
                'twitter' => 'Twitter',
                'linkedin' => 'LinkedIn',
            ])
            ->live(), // Re-evaluates icon when selection changes
        TextInput::make('url')->url()->


TabRepeater::make('items')
    ->reorderable(true) // Enable drag-and-drop tab headers
    // OR
    ->reorderable(false) // Disable tab reordering


TabRepeater::make('social_links')
    ->schema([
        //...
    ])
    ->tabContentStyle('box-shadow:none')
    //or
    ->tabContentStyle(function (array $state) {
        return match ($state['language_code'] ?? null) {
            'en' => 'background-color: red',
            'zh-CN' => 'background-color: blue;',
            default => 'background-color: green',
        };
    })


use App\Forms\Components\TabRepeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;
use Filament\Support\Icons\Heroicon;

TabRepeater::make('translations')
    ->label('Translations')
    ->itemLabel(fn (array $state) => strtoupper($state['locale'] ?? 'New Locale'))
    ->itemIcon(Heroicon::Language)
    ->schema([
        Select::make('locale')
            ->options([
                'en' => 'English',
                'es' => 'Spanish',
                'de' => 'German',
            ])
            ->


TabRepeater::make('variants')
    ->label('Product Variants')
    ->itemLabel(fn (array $state) => $state['sku'] ?? $state['name'] ?? 'New Variant')
    ->itemIcon(Heroicon::OutlinedTag)
    ->schema([
        TextInput::make('name')->placeholder('e.g., Large / Black')->live(onBlur: true),
        TextInput::make('sku')->

TabRepeater::make('slides')
    ->label('Homepage Banner Slides')
    ->itemLabel(fn (array $state) => $state['heading'] ?? 'Slide Title')
    ->itemIcon(Heroicon::OutlinedPhoto)
    ->schema([
        TextInput::make('heading')->live(onBlur: true),
        TextInput::make('cta_text'),
        TextInput::make('cta_url')->url(),
        FileUpload::make('desktop_image')->image()->

TabRepeater::make('plans')
    ->label('Subscription Plans')
    ->itemLabel(fn (array $state) => $state['name'] ?? 'Plan')
    ->itemIcon(fn (array $state) => match($state['badge'] ?? null) {
        'popular' => Heroicon::OutlinedStar,
        'enterprise' => Heroicon::OutlinedBuildingOffice,
        default => Heroicon::OutlinedCreditCard,
    })
    ->schema([
        TextInput::make('name')->live(onBlur: true)->
bash
php artisan vendor:publish --tag="filament-tab-repeater-views"