Skip to content

Commit 0a8a0c0

Browse files
committed
Move markers & extra after items
1 parent 4f8fb10 commit 0a8a0c0

File tree

1 file changed

+32
-32
lines changed

1 file changed

+32
-32
lines changed

README.md

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,15 @@
3838
* [Borders](#borders)
3939
* [Exit Button Text](#exit-button-text)
4040
* [Remove Exit Button](#remove-exit-button)
41-
* [Item Markers](#item-markers)
42-
* [Item Extra](#item-extra)
4341
* [Items](#appearance)
4442
* [Selectable Item](#selectable-item)
4543
* [Line Break Item](#line-break-item)
4644
* [Static Item](#static-item)
4745
* [Ascii Art Item](#ascii-art-item)
4846
* [Sub Menu Item](#sub-menu-item)
4947
* [Disabling Items & Sub Menus](#disabling-items--sub-menus)
48+
* [Item Markers](#item-markers)
49+
* [Item Extra](#item-extra)
5050
* [Menu Methods](#menu-methods)
5151
* [Redrawing the Menu](#redrawing-the-menu)
5252
* [Getting, Removing and Adding items](#getting-removing-and-adding-items)
@@ -385,36 +385,6 @@ $menu = (new CliMenuBuilder)
385385
->build();
386386
```
387387

388-
##### Item Markers
389-
390-
The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported.
391-
The marker for un-selected items can also be modified. If you want to disable it, just set it to a space character.
392-
393-
```php
394-
$menu = (new CliMenuBuilder)
395-
->setUnselectedMarker('❅')
396-
->setSelectedMarker('✏')
397-
398-
//disable unselected marker
399-
->setUnselectedMarker(' ')
400-
->build();
401-
```
402-
403-
#### Item Extra
404-
405-
You can optionally display some arbitrary text on the right hand side of an item. You can customise this text and
406-
you indicate which items to display it on. We use it to display `[COMPLETED]` on completed exercises, where the menu lists
407-
exercises for a workshop application.
408-
409-
The third parameter to `addItem` is a boolean whether to show the item extra or not. It defaults to false.
410-
411-
```php
412-
$menu = (new CliMenuBuilder)
413-
->setItemExtra('✔')
414-
->addItem('Exercise 1', function (CliMenu $menu) { echo 'I am complete!'; }, true)
415-
->build();
416-
```
417-
418388
#### Items
419389

420390
There a few different types of items you can add to your menu
@@ -606,6 +576,36 @@ The third param on the `->addItem` call is what disables an item while the `->di
606576

607577
The outcome is a full menu with dimmed rows to denote them being disabled. When a user navigates these items are jumped over to the next available selectable item.
608578

579+
##### Item Markers
580+
581+
The marker displayed by the side of the currently active item can be modified, UTF-8 characters are supported.
582+
The marker for un-selected items can also be modified. If you want to disable it, just set it to a space character.
583+
584+
```php
585+
$menu = (new CliMenuBuilder)
586+
->setUnselectedMarker('❅')
587+
->setSelectedMarker('✏')
588+
589+
//disable unselected marker
590+
->setUnselectedMarker(' ')
591+
->build();
592+
```
593+
594+
#### Item Extra
595+
596+
You can optionally display some arbitrary text on the right hand side of an item. You can customise this text and
597+
you indicate which items to display it on. We use it to display `[COMPLETED]` on completed exercises, where the menu lists
598+
exercises for a workshop application.
599+
600+
The third parameter to `addItem` is a boolean whether to show the item extra or not. It defaults to false.
601+
602+
```php
603+
$menu = (new CliMenuBuilder)
604+
->setItemExtra('✔')
605+
->addItem('Exercise 1', function (CliMenu $menu) { echo 'I am complete!'; }, true)
606+
->build();
607+
```
608+
609609
### Menu Methods
610610

611611
The next set of documentation applies to methods available directly on the `\PhpSchool\CliMenu\CliMenu` instance. Typically

0 commit comments

Comments
 (0)