Reorder
Rank a list by moving items into the order you want. It returns a
list<string> - a full permutation of the option values, never a subset.
$p->reorder('basket', 'Rank your basket')
->options([
'apple' => 'Apple',
'carrot' => 'Carrot',
'tomato' => 'Tomato',
])
->default(['apple', 'carrot']) // Seed the starting order; omitted items are appended.
->pageSize(10); // Items visible before the list pages around the cursor.
Runnable script: playground/02-widgets/reorder.php.
Options
| Name | Description | Required | Default |
|---|---|---|---|
options() | The items to rank, as a value => label map. | Yes | - |
default() | Seeds the starting order; any omitted options are appended in declared order, so the ranking is always complete. | No | Declared order |
pageSize() | Items shown before the list pages around the cursor. | No | 10 |
Keyboard
| Key | Action |
|---|---|
↑ / ↓ | Move the highlight, or carry a held item through the list |
Space | Pick the highlighted item up, or drop a held one |
Enter | Drop a held item, or accept when nothing is held |
Esc | Cancel |
Display modes
In all four display modes - Unicode or ASCII, colour on or off:
| ANSI | No ANSI | |
| Unicode | ||
| ASCII |