File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -417,7 +417,8 @@ $menu->open();
417
417
418
418
#### Getting, Removing and Adding items
419
419
420
- You can also interact with the menu items in an action:
420
+ You can also interact with the menu items in an action. You can add, remove and replace items. If you do this, you
421
+ will likely want to redraw the menu as well so the new list is rendered.
421
422
422
423
``` php
423
424
use PhpSchool\CliMenu\MenuItem\LineBreakItem;
@@ -429,7 +430,14 @@ $itemCallable = function (CliMenu $menu) {
429
430
$menu->removeItem($item);
430
431
}
431
432
433
+ //add single item
432
434
$menu->addItem(new LineBreakItem('-'));
435
+
436
+ //add multiple items
437
+ $menu->addItems([new LineBreakItem('-'), new LineBreakItem('*')]);
438
+
439
+ //replace all items
440
+ $menu->setItems([new LineBreakItem('+'), new LineBreakItem('-')]);
433
441
434
442
$menu->redraw();
435
443
};
You can’t perform that action at this time.
0 commit comments