Skip to content

lumite-studios/livewire-repeatable

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lumite-studios/livewire-repeatable

PHP ^8.0 Laravel ^8.52 Livewire ^2.5

Installation

composer require lumite-studios/livewire-repeatable

Usage

The "Repeatable Component" requires a view path to be passed as a property. You can optionally pass existing items as an array and a theme (or you can style it with your own classes.).

form.blade.php

<livewire:repeatable-component
	:items="$items ?? [['input' => 'test']]"
	theme="tailwind"
	view="repeating-view"
/>

Within the repeating view an index and a data property will be available. The index can be used for any input names, and the data property will contain any data passed through the items property.

repeating-view.blade.php

<div class="flex-grow">
	<label for="fields[{{ $index }}][input]">Input</label>
	<input name="fields[{{ $index }}][input]" type="text" :value="$data['input'] ?? null">
</div>