liveBook · Manning

Selection list

As explained in Build a Website with ChatGPT

A selection list is a form control that presents multiple options for user selection, typically through a list interface.

A selection list is a form control for choosing from several options. It usually appears as a dropdown: clicking it opens a menu of available choices. section 8.3.7

Use a selection list when a form offers five or more choices. It keeps a large set of options from becoming confusing or taking up too much page space, unlike a long group of radio buttons. section 8.3.7 section 8.7

Customize a selection list by specifying:

  • The option selected when the form first appears. section 8.3.7
  • Whether users can select multiple options with Ctrl on Windows or Cmd on macOS. section 8.3.7
  • The number of visible rows. A smaller height creates a scrollable list box instead of a dropdown. section 8.3.7

Useful selection-list prompts

Ask for a mood list with Happy, Content, Neutral, Melancholy, and Sad, making Neutral the initial choice. For a multiple-choice list, label it “Philosophers You've Read” and include Plato, Aristotle, Blaise Pascal, Friedrich Nietzsche, and Jean-Paul Sartre. To display all five vacation choices at once, give a “Dream Vacation” list a height of five rows.

How Build a Website with ChatGPT covers it

How deep it goes
Explains dropdown behavior and three customizations, but stops short of showing the complete control markup.
Examples
Demonstrates animal, mood, philosopher, and vacation lists with initial selections, multiple selection, and visible-row settings.
What it assumes
Assumes basic awareness of form controls while teaching the choice between radio buttons and selection lists.
What you can do after
Build it from scratch by specifying options and asking ChatGPT to generate the surrounding HTML form and CSS.
How it connects
Connects selection lists with forms, radio buttons, labels, buttons, and submitting form data.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Build a Website with ChatGPT. The section links point to the parts of the book it draws on.