ToggleButtons: Click to untoggle

Hi, I have a ToggleButtons-Component set up with an Enum-class. Is there a way to "untoggle" an already selected togglebutton. The desired result is that the delivery_method is set to null in the db.
ToggleButtons::make('delivery_method')
->hiddenLabel()
->options(DeliveryMethod::class)
->reactive()
->inline()
->afterStateUpdated(function (string $state, Retouche $record): void {
$record->update([
'delivery_method' => $state,
]);

// Optionally notify the user
Notification::make()
->title('Delivery method updated')
->success()
->send();
}),
ToggleButtons::make('delivery_method')
->hiddenLabel()
->options(DeliveryMethod::class)
->reactive()
->inline()
->afterStateUpdated(function (string $state, Retouche $record): void {
$record->update([
'delivery_method' => $state,
]);

// Optionally notify the user
Notification::make()
->title('Delivery method updated')
->success()
->send();
}),
3 Replies
Adam Holmes
Adam Holmes4w ago
@HirryBirry Did you find a solution to this?
Matthew
Matthew4w ago
Maybe add a clearing hintAction ?
Adam Holmes
Adam Holmes4w ago
Works a treat - thanks for the idea 🙂

Did you find this page helpful?