summaryrefslogtreecommitdiff
path: root/src/Toolbar/Dropdown.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/Toolbar/Dropdown.php')
-rw-r--r--src/Toolbar/Dropdown.php44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/Toolbar/Dropdown.php b/src/Toolbar/Dropdown.php
new file mode 100644
index 0000000..45bdbee
--- /dev/null
+++ b/src/Toolbar/Dropdown.php
@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+namespace Lightscale\LaralightTables\Toolbar;
+
+use Illuminate\Support\Collection;
+use Illuminate\View\View;
+use Lightscale\LaralightTables\Toolbar\Concerns\WithAttributes;
+use Lightscale\LaralightTables\Toolbar\Concerns\WithSlot;
+use Lightscale\LaralightTables\Toolbar\Dropdown\Item as DropdownItem;
+
+class Dropdown extends Item
+{
+ use WithAttributes;
+ use WithSlot;
+
+ /**
+ * @var Collection<int, DropdownItem>
+ */
+ protected Collection $items;
+
+ /**
+ * @param iterable<int, DropdownItem> $items
+ */
+ public function items(iterable $items): static
+ {
+ $this->items = Collection::wrap($items);
+
+ return $this;
+ }
+
+ public function render(): View
+ {
+ return view(
+ 'laralight-tables::toolbar.dropdown',
+ [
+ 'attributes' => $this->getAttributes(),
+ 'slot' => $this->slot,
+ 'items' => $this->items,
+ ]
+ );
+ }
+}