You're looking for dialog. It's a very powerful tool and uses ncurses to provide a lot of options. I suggest you read through its manpage. Specifically, you want the --menu option:
--menu text height width menu-height [ tag item ] ...
As its name suggests, a menu box is a dialog box that can be
used to present a list of choices in the form of a menu for the
user to choose. Choices are displayed in the order given. Each
menu entry consists of a tag string and an item string. The tag
gives the entry a name to distinguish it from the other entries
in the menu. The item is a short description of the option that
the entry represents. The user can move between the menu en‐
tries by pressing the cursor keys, the first letter of the tag
as a hot-key, or the number keys 1-9. There are menu-height en‐
tries displayed in the menu at one time, but the menu will be
scrolled if there are more entries than that.
On exit the tag of the chosen menu entry will be printed on dia‐
log's output. If the "--help-button" option is given, the cor‐
responding help text will be printed if the user selects the
help button.
Unfortunately, implementing it in a sane manner using the output of a command that contains spaces is quite complex because of various quoting issues. At any rate, I didn't manage to do it, and had to resort to using eval. Nevertheless, it does work and does what you asked for:
#!/usr/bin/env bash
tmp=$(mktemp)
IFS=
eval dialog --menu \"Please choose a filesystem:\" 50 50 10 $(lsblk -f | sed -r 's/^/"/;s/$/" " "/' | tr $'\n' ' ') 2>$tmp
D=$(tr -d '│├└─' < $tmp | sed 's/^[ \t]*//' | cut -d' ' -f1)
printf "You chose:\n%s\n" "$D"
For a more portable approach, change the grep command to
The sed just formats the output of lsblk so that there are quotes around each output line (that's dialog's "tag"), followed by a quoted space (that's dialog's "item") and the tr replaces newlines with spaces and the tree-part-characters.
The result looks like this:
┌────────────────────────────────────────────────┐
│ Please choose a filesystem: │
│ ┌────────────────────────────────────────────┐ │
│ │ NAME FSTYPE LABEL MOUNTPOINT │ │
│ │ sda │ │
│ │ ├─sda1 │ │
│ │ ├─sda2 │ │
│ │ ├─sda3 /winblows │ │
│ │ ├─sda4 │ │
│ │ ├─sda5 │ │
│ │ ├─sda6 /home │ │
│ │ ├─sda7 / │ │
│ │ └─sda8 [SWAP] │ │
│ └────↓(+)────────────────────────────90%─────┘ │
│ │
├────────────────────────────────────────────────┤
│ < OK > <Cancel> │
└────────────────────────────────────────────────┘