liveBook · Manning

Radio button

As explained in Build a Website with ChatGPT

A radio button is a form control that lets a user select one option from a group of mutually exclusive choices.

A radio button is a small circular form control for choosing exactly one option from a group. Selecting one fills its circle and clears the previously selected option. section 8.3.6

Use radio buttons when the choices are mutually exclusive and the group is short:

  • Offer choices such as Friday, Saturday, or Sunday for an event. section 8.3.6
  • Offer a small set of shirt sizes, such as Small, Medium, Large, and Extra Large. section 8.3.6
  • Prefer a selection list when there are more than about four choices, because many radio buttons can confuse users and consume page space. section 8.3.7

T-shirt size

Create a group labeled “Choose a t-shirt size” with Small, Medium, Large, and Extra Large options. Make Medium initially selected. A legend supplies the group caption, while the selected value is the choice submitted with the form. section 8.3.6 section 8.5.1

In submitted HTML forms, each radio button has a name identifying its field and a value identifying that option. The browser sends the value of the selected button; for example, a day field can submit Saturday. section 8.5.1

A group of radio buttons with the following options: "Small", "Medium", "Large", and "Extra Large". Include a legend element with the caption "Choose a t-shirt size".

Inspect a complete radio-button prompt with Small, Medium, Large, and Extra Large choices and the legend “Choose a t-shirt size.” section 8.3.6

How Build a Website with ChatGPT covers it

How deep it goes
Explains appearance, selection behavior, group sizing, legends, initial choices, and submitted name/value attributes without descending into advanced implementation.
Examples
Demonstrates event days, T-shirt sizes, an initially selected Medium option, and a submitted Saturday value.
What you can do after
Apply it via HTML and ChatGPT prompts to create short single-choice form groups with labels, initial selections, and submitted values.
How it connects
Connects radio buttons to HTML forms, check boxes, selection lists, legends, form submission, and event sign-up pages.

Also explained in

Compare how 4 books explain radio button →

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.