Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

adnanerlansyah403's avatar

How to passing or override the values of input I livewire

Hello everyone, I need help. About how should I do for passing the value to the input field using wire:model of livewire. Because by default wire:model can't filled with attributes value, so for example I have a case input data for date but I'm using library js like datepicker. So the input field's must be fill automatically with that package

0 likes
3 replies
aleahy's avatar

You could use the mount lifecycle hook to set data when the component is mounted in the page.

public function mount()
{
	$this->attributeForInput = 'some value';
}
1 like
adnanerlansyah403's avatar

@aleahy So in input's field is like this?

<input wire:model="dateInput" />

And then I set that input to the mount without give a parameters like this

public $dateInput;

public function mount()
{
	$this->dateInput = 'some value';
}

Please or to participate in this conversation.