Skip to content

Latest commit

 

History

History
45 lines (33 loc) · 1.35 KB

File metadata and controls

45 lines (33 loc) · 1.35 KB

Single Select

A single select component asks a user to choose one item from a list. It is similar to a simple dropbox implementation. The following listing shows an example:

link:../../../../../src/test/java/org/springframework/shell/docs/UiComponentSnippets.java[role=include]

The following screencast shows typical output for a single select component:

link:example$component-single-select-1.cast[role=include]

The context object is SingleItemSelectorContext. The following table describes its context variables:

Table 1. SingleItemSelectorContext Template Variables
Key Description

value

The returned value when the component exists.

rows

The visible items, where rows contains maps of name and selected items.

model

The parent context variables (see SelectorComponentContext Template Variables).

You can pre-select an item by defining it to get exposed. This is useful if you know the default and lets the user merely press Enter to make a choice. The following listing sets a default:

link:../../../../../src/test/java/org/springframework/shell/docs/UiComponentSnippets.java[role=include]