Best–Worst
<forma-best-worst>
Capture distinct strongest and weakest choices without hiding the two-selection constraint.
- Authoring tag
<forma-best-worst>- Category
- Assessment and survey
- Behavior owner
- Application / Limen
- Canonical source
patterns/best-worst.html
Purpose
Best–Worst (MaxDiff) shows a set of items and asks for the most and least important. Forma renders it as a small grid: one row per item, with a Best radio and a Worst radio. The Best radios form one native group and the Worst radios another, so the browser guarantees one Best and one Worst. What HTML cannot enforce is that they differ; the application (Limen) checks that rule, sets aria-invalid and writes the status line. The constraint is always stated in visible text, never implied by the layout.
Use when
- Relative importance is measured across sets of three to six items.
- You need the extremes of a set rather than a full order.
- Rating scales produce too little differentiation because everything is rated important.
Avoid when
- Only two items are compared: use Pairwise choice.
- A complete order is required: use Ranking.
- Items are rated independently: use Single-choice matrix.
- Effort is distributed numerically across items: use Allocation.
Behavior to know
- Two independent radio groups across the same rows (Best and Worst).
- Each radio has an explicit accessible name combining the item and the role, such as "Reliability, Best".
- The column header row is visual only (
aria-hidden) and disappears below 44rem. - A polite live status line reports incomplete, conflicting or complete state as written by the application.
Basic example
The smallest correct markup: the canonical pattern from patterns/best-worst.html inside its public tag. Copy this first, then adapt labels, names and state.
Minimal best–worst
Rendered from the canonical pattern file.
<forma-best-worst class="forma-component-tag">
<fieldset class="forma-best-worst">
<legend class="forma-best-worst__legend">Choose the most important and least important item.</legend>
<p class="forma-field__description">One item must be Best and a different item must be Worst. Limen enforces the cross-column constraint.</p>
<div class="forma-best-worst__header" aria-hidden="true">
<span>Option</span><span>Best</span><span>Worst</span>
</div>
<div class="forma-best-worst__row">
<span id="bw-reliability">Reliability</span>
<label><input type="radio" name="best" value="reliability" aria-labelledby="bw-reliability bw-best-label"><span class="forma-sr-only" id="bw-best-label">Best</span></label>
<label><input type="radio" name="worst" value="reliability" aria-labelledby="bw-reliability bw-worst-label"><span class="forma-sr-only" id="bw-worst-label">Worst</span></label>
</div>
<div class="forma-best-worst__row">
<span id="bw-speed">Delivery speed</span>
<label><input type="radio" name="best" value="speed" aria-label="Delivery speed, Best"></label>
<label><input type="radio" name="worst" value="speed" aria-label="Delivery speed, Worst"></label>
</div>
<p class="forma-best-worst__status" data-forma-state="incomplete" aria-live="polite">Choose one Best and one Worst.</p>
</fieldset>
</forma-best-worst>
Click or tap the code once to select all of it, then copy.
Examples
Same item chosen as Best and Worst
The user has chosen Cost efficiency for both roles. The application marks the Worst group invalid and explains the rule in the live status line; Forma supplies no automatic correction.
<forma-best-worst class="forma-component-tag">
<fieldset class="forma-best-worst" aria-describedby="bestworst-conflict-help">
<legend class="forma-best-worst__legend">Which is most and least important when choosing a vendor?</legend>
<p class="forma-field__description" id="bestworst-conflict-help">Choose one Best and a different Worst.</p>
<div class="forma-best-worst__header" aria-hidden="true"><span>Option</span><span>Best</span><span>Worst</span></div>
<div class="forma-best-worst__row">
<span>Support quality</span>
<label><input type="radio" name="bestworst-conflict-best" value="support" aria-label="Support quality, Best"></label>
<label><input type="radio" name="bestworst-conflict-worst" value="support" aria-label="Support quality, Worst" aria-invalid="true"></label>
</div>
<div class="forma-best-worst__row">
<span>Security certifications</span>
<label><input type="radio" name="bestworst-conflict-best" value="security" aria-label="Security certifications, Best"></label>
<label><input type="radio" name="bestworst-conflict-worst" value="security" aria-label="Security certifications, Worst" aria-invalid="true"></label>
</div>
<div class="forma-best-worst__row">
<span>Cost efficiency</span>
<label><input type="radio" name="bestworst-conflict-best" value="cost" checked aria-label="Cost efficiency, Best"></label>
<label><input type="radio" name="bestworst-conflict-worst" value="cost" checked aria-label="Cost efficiency, Worst" aria-invalid="true"></label>
</div>
<div class="forma-best-worst__row">
<span>Integration options</span>
<label><input type="radio" name="bestworst-conflict-best" value="integrations" aria-label="Integration options, Best"></label>
<label><input type="radio" name="bestworst-conflict-worst" value="integrations" aria-label="Integration options, Worst" aria-invalid="true"></label>
</div>
<p class="forma-best-worst__status" data-forma-state="invalid" aria-live="polite">Cost efficiency cannot be both Best and Worst. Choose a different Worst.</p>
</fieldset>
</forma-best-worst>
Click or tap the code once to select all of it, then copy.
Completed set with long item names
Distinct Best and Worst chosen; the application has written a completion status. Long item names wrap in the first column while the radio columns keep their width.
<forma-best-worst class="forma-component-tag">
<fieldset class="forma-best-worst">
<legend class="forma-best-worst__legend">Which change would help your on-call week most and least?</legend>
<div class="forma-best-worst__header" aria-hidden="true"><span>Option</span><span>Best</span><span>Worst</span></div>
<div class="forma-best-worst__row">
<span>Alerts routed to the owning team instead of a shared rotation</span>
<label><input type="radio" name="bestworst-complete-best" value="routing" checked aria-label="Alerts routed to the owning team, Best"></label>
<label><input type="radio" name="bestworst-complete-worst" value="routing" aria-label="Alerts routed to the owning team, Worst"></label>
</div>
<div class="forma-best-worst__row">
<span>Runbooks linked from every alert</span>
<label><input type="radio" name="bestworst-complete-best" value="runbooks" aria-label="Runbooks linked from every alert, Best"></label>
<label><input type="radio" name="bestworst-complete-worst" value="runbooks" aria-label="Runbooks linked from every alert, Worst"></label>
</div>
<div class="forma-best-worst__row">
<span>Compensatory time off after night pages</span>
<label><input type="radio" name="bestworst-complete-best" value="time-off" aria-label="Compensatory time off after night pages, Best"></label>
<label><input type="radio" name="bestworst-complete-worst" value="time-off" checked aria-label="Compensatory time off after night pages, Worst"></label>
</div>
<p class="forma-best-worst__status" data-forma-state="complete" aria-live="polite">Best and Worst chosen.</p>
</fieldset>
</forma-best-worst>
Click or tap the code once to select all of it, then copy.
Mobile
Each mobile example renders in its own document inside a real narrow viewport, so Forma's media and container queries run exactly as they would on a phone. Choose a width to compare.
Best–Worst on a phone
Below 44rem the column header is hidden and the radio columns shrink to 44px. The accessible names already state Best or Worst, but the visible description repeats which column is which.
What changes at narrow widths
- The header row (Option, Best, Worst) is hidden below 44rem, so the description must state the column order in text.
- Radio columns change from a fixed 4.5rem to
minmax(2.75rem, auto), giving the item name more room. - Each radio label keeps a 44px minimum height as its tap target; the native radio itself is 1.25rem.
- Item names wrap within the first column; there is no horizontal scroll at 320px.
<forma-best-worst class="forma-component-tag">
<fieldset class="forma-best-worst" aria-describedby="bestworst-mobile-help">
<legend class="forma-best-worst__legend">Most and least useful meeting?</legend>
<p class="forma-field__description" id="bestworst-mobile-help">In each row, the first circle is Best and the second is Worst.</p>
<div class="forma-best-worst__header" aria-hidden="true"><span>Option</span><span>Best</span><span>Worst</span></div>
<div class="forma-best-worst__row">
<span>Daily stand-up</span>
<label><input type="radio" name="bestworst-mobile-best" value="standup" aria-label="Daily stand-up, Best"></label>
<label><input type="radio" name="bestworst-mobile-worst" value="standup" aria-label="Daily stand-up, Worst"></label>
</div>
<div class="forma-best-worst__row">
<span>Sprint planning</span>
<label><input type="radio" name="bestworst-mobile-best" value="planning" aria-label="Sprint planning, Best"></label>
<label><input type="radio" name="bestworst-mobile-worst" value="planning" aria-label="Sprint planning, Worst"></label>
</div>
<div class="forma-best-worst__row">
<span>Retrospective</span>
<label><input type="radio" name="bestworst-mobile-best" value="retro" aria-label="Retrospective, Best"></label>
<label><input type="radio" name="bestworst-mobile-worst" value="retro" aria-label="Retrospective, Worst"></label>
</div>
<p class="forma-best-worst__status" data-forma-state="incomplete" aria-live="polite">Choose one Best and one Worst.</p>
</fieldset>
</forma-best-worst>
Click or tap the code once to select all of it, then copy.
Mobile · 320px
The canonical pattern in a true 320px viewport, the minimum width every Forma component must support without page-level horizontal scrolling.
API and configuration
Forma components have no JavaScript API. Their public contract is the markup: native elements and attributes you write, and the CSS hooks below. The CSS hook table is generated from the built stylesheet, so it always matches the shipped implementation.
| Attribute | On | Values | Default | Description |
|---|---|---|---|---|
type | input | radio | — | Radios: one group for Best, one for Worst. |
name | input | one name for all Best radios, another for all Worst radios | — | The two names make Best and Worst each single-select. Unique per question. |
value | input | item identifier | — | The item chosen for that role. |
checked | input | boolean | absent | Restores saved Best and Worst choices. |
aria-label | input | "<item>, Best" or "<item>, Worst" | — | Required. The radios have no visible text of their own, so each needs a name that combines item and role. aria-labelledby pointing at the item text and a role label is equivalent. |
aria-labelledby | input | ids of item text and role label | — | Alternative to aria-label used by the canonical pattern. |
aria-invalid | inputs | true | absent | Set by the application when the same item holds both roles or a role is missing on submit. |
aria-live | .forma-best-worst__status | polite | — | Announces the application's status text when it changes. |
data-forma-state | .forma-best-worst__status | incomplete | invalid | complete (application-defined) | — | Application state marker for the status line. Forma currently applies no styling for it; the text carries the meaning. |
aria-describedby | fieldset | id list | — | Associates the rule or column explanation with the group. |
| Hook | Kind | Values or default | Description |
|---|---|---|---|
.forma-best-worst | Block class | — | Root fieldset with browser border and padding removed. |
.forma-best-worst__header | Element class | — | Visual column headings. Mark aria-hidden; hidden below 44rem. |
.forma-best-worst__legend | Element class | — | Question text. |
.forma-best-worst__row | Element class | — | Bordered three-column grid row: item text, Best radio, Worst radio. Consecutive rows share borders. |
.forma-best-worst__status | Element class | — | Status line written by the application; place it in a polite live region. |
| Keys | Result |
|---|---|
| Tab / Shift+Tab | Visits the Best group, then the Worst group (each is one tab stop), in source order. |
| Arrow keys | Native radio behavior within the focused group: moves down or up the column and selects. |
| Space | Selects the focused radio when that group has no selection. |
| Event | Description |
|---|---|
input / change | Native events from each group. Limen listens to both to enforce the distinct-selection rule and update the status. |
Form behavior
Submits the Best name=value and the Worst name=value. HTML cannot stop both naming the same item; the application must validate before accepting.
States
| State | How it is expressed | Presentation |
|---|---|---|
| Incomplete | fewer than two checked radios; status text | The status line asks for the missing choice. |
| Conflict | same value checked in both groups; aria-invalid and status text set by the application | Status explains the rule. Forma adds no conflict styling. |
| Complete | distinct values checked; status text | Status confirms both choices. |
| Focus | :focus-visible on a radio | The foundation focus ring on the native radio. |
Accessibility
Forma provides
- Keeps Best and Worst as two native radio groups with visible native radios and 44px-tall hit rows.
- Presents the header as visual-only so screen readers rely on each radio's explicit name.
- Provides a status line styled for a polite live region.
Your application supplies
- Name every radio with item plus role.
- Enforce distinct Best and Worst, set aria-invalid and write status text that says what to change.
- State the column meaning in visible text, because the header row is hidden on phones.
- Present sets sequentially with Survey progress when running a multi-set exercise.
Responsive behavior
- Wide:
minmax(10rem, 1fr) 4.5rem 4.5remcolumns for item, Best and Worst. - Below 44rem: header hidden, radio columns shrink to
minmax(2.75rem, auto)and row padding tightens. - Item text wraps; the grid never forces horizontal scroll.
Motion
- No animation: radios are native and change immediately; the status line updates without transition.
Usage guidance
Do
- Keep sets to three to six items so both extremes are easy to judge.
- Explain the Best/Worst rule before the rows.
Avoid
- Silently unchecking the other role when a conflict occurs; tell the user instead.
- Relying on column position alone to tell Best from Worst.
Verification specimens
Generated fault-injection specimens expose content, spacing, color-cue, and reduced-effective-contrast risks. They screen presentation robustness as engineering screens without claiming human-subject validation.