Custom Livewire component

Please read the Custom Field page. It is recommended that you create a Custom Field instead of using this method because Livewire doesn't handle nested components very well.

livewireComponent(string $component, array $params = [])

  • Replace the field with your own Livewire component.

  • $component = String, the path and name (as path.name) to a Livewire component

  • $params = Optional array with parameters to pass to the child component.

custom() or emitUp()

In this example we are using the custom() method to tell the component that we want to handle this field manually. (see manually saving data). Another option could be to do emitUp() (see Livewire docs) in the child component to populate the field in the main form component.

Example

The example is for a fictive Livewire/App/Tags component with three properties.

Input::make('Tags')
    ->custom()
    ->livewireComponent("app.tags",
        [
            'model' => $this->model,
            'tagType' => "event",
            'setLocale' => "sv"
        ]),

Last updated