Skip to content

Commit 37f0040

Browse files
committed
Support radio items
1 parent c1874ee commit 37f0040

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Menu/Items/Radio.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Radio extends MenuItem
66
{
77
protected string $type = 'radio';
88

9-
public function __construct(string $label)
9+
public function __construct(string $label, protected bool $isChecked = false, protected ?string $accelerator = null)
1010
{
1111
$this->label = $label;
1212
}

src/Menu/MenuBuilder.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Native\Laravel\Client\Client;
66
use Native\Laravel\Contracts\MenuItem;
77
use Native\Laravel\Enums\RolesEnum;
8+
use Native\Laravel\Menu\Items;
89

910
class MenuBuilder
1011
{
@@ -58,6 +59,11 @@ public function checkbox(string $label, bool $checked = false, ?string $hotkey =
5859
return new Items\Checkbox($label, $checked, $hotkey);
5960
}
6061

62+
public function radio(string $label, bool $checked = false, ?string $hotkey = null): Items\Radio
63+
{
64+
return new Items\Radio($label, $checked, $hotkey);
65+
}
66+
6167
public function event(string $event, ?string $label = null, ?string $hotkey = null): Items\Event
6268
{
6369
return new Items\Event($event, $label, $hotkey);

0 commit comments

Comments
 (0)