get updated property value in view form field

In the simple page I have a public property public int $strengthScore = 0;

I set it using the $set method.

TextInput::make('password')
  ->live()
  // other rules
  ->hintAction(
      Action::make('generate')
          ->label('Generate')
          ->action(function (Set $set, Get $get) {
              $password = Str::password(12);
              $set('password', $password);
              $set('passwordConfirmation', $password);
              $set('strengthScore', (new Zxcvbn())->passwordStrength($password)['score']);
          }),
  );


But how to get strengthScore value in the ViewField after it is updated?

Tried $wire.$entangle in the x-data but it get only the initial value.
<div x-data="{ strengthScore: $wire.$entangle('strengthScore', live = true) }">
    <progress value="{{ $this->strengthScore }}" max="4" class="w-full"></progress>
</div>
Solution
Sending event:
$score = (new Zxcvbn())->passwordStrength($password)['score'];
$set('strengthScore', $score);
$this->dispatch('update-score', score: $score);
Was this page helpful?