Repeater shows up collapsed - why?

I dont want this repeater to show collapsed, when the form loads. I want to show one item.
Card::make()
->schema([
Repeater::make('start_times')
->label('Hora(s) de inicio')
->hint(__('Haciendo clic en el icono clonar puedes añadir más rápido.'))
->createItemButtonLabel(__('+ Añadir hora de inicio'))
->columns(2)
->required()
->cloneable()
->disableItemMovement()
->minItems(1)
->defaultItems(1)
->schema([

TimePicker::make('start_time')
->label('Hora de inicio')
->default('12:00')
->withoutSeconds()
->required(),

]),
]),
Card::make()
->schema([
Repeater::make('start_times')
->label('Hora(s) de inicio')
->hint(__('Haciendo clic en el icono clonar puedes añadir más rápido.'))
->createItemButtonLabel(__('+ Añadir hora de inicio'))
->columns(2)
->required()
->cloneable()
->disableItemMovement()
->minItems(1)
->defaultItems(1)
->schema([

TimePicker::make('start_time')
->label('Hora de inicio')
->default('12:00')
->withoutSeconds()
->required(),

]),
]),
`
No description
3 Replies
Albert Lens
Albert Lens14mo ago
Have you tried with ->collapsed(false) ? And also, from your image I can see it is not collapsed. It really has created no item at all.
Falk Maria Zeitsprung
yes, i have tried collapsed(false), but it still shows up closed, when i load the form. why does that code show up the repeater item in collapsed? I need it open.
Card::make()
->schema([
Repeater::make('start_times')
->label('Hora(s) de inicio')
->hint(__('Haciendo clic en el icono clonar puedes añadir más rápido.'))
->createItemButtonLabel(__('+ Añadir hora de inicio'))
->columns(2)
->required()
->cloneable()
->disableItemMovement()
->minItems(1)
->defaultItems(1)
->collapsed(false)
->schema([

TimePicker::make('start_time')
->label('Hora de inicio')
->default('12:00')
->withoutSeconds()
->required(),

]),
]),
Card::make()
->schema([
Repeater::make('start_times')
->label('Hora(s) de inicio')
->hint(__('Haciendo clic en el icono clonar puedes añadir más rápido.'))
->createItemButtonLabel(__('+ Añadir hora de inicio'))
->columns(2)
->required()
->cloneable()
->disableItemMovement()
->minItems(1)
->defaultItems(1)
->collapsed(false)
->schema([

TimePicker::make('start_time')
->label('Hora de inicio')
->default('12:00')
->withoutSeconds()
->required(),

]),
]),
\ Also if i paste the example from the v2 documentation it appears collapsed:
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;

Repeater::make('members')
->schema([
TextInput::make('name')->required(),
Select::make('role')
->options([
'member' => 'Member',
'administrator' => 'Administrator',
'owner' => 'Owner',
])
->required(),
])
->columns(2)
use Filament\Forms\Components\Repeater;
use Filament\Forms\Components\Select;
use Filament\Forms\Components\TextInput;

Repeater::make('members')
->schema([
TextInput::make('name')->required(),
Select::make('role')
->options([
'member' => 'Member',
'administrator' => 'Administrator',
'owner' => 'Owner',
])
->required(),
])
->columns(2)
` Is there in filament any config var which maybe is controlling this? I pasted the code in other forms in my filamente v2 app, and always the repeater appears collapsed.
awcodes
awcodes14mo ago
This is not a collapsed repeater. This is a repeater with no items. defaultItems() only works on create Also, make sure your field on your model is cast to an array.
Want results from more Discord servers?
Add your server