Skip to content
SkillCodex
Menu

Listbox

Listbox

A composite widget of named options that supports one or multiple selections and can be standalone or used as a combobox popup.

Try the component
Context, sources and actions
Sources and revision
Updated
Version
v1.0.26 · r2
Sources
5 sources
Status
Published
Read the sources

You may have searched for: keep all choices visible in a boxa selectable list that does not collapseuse arrows to move through visible options

All phrasings
Save and share

Recognize

Choose from a list

Try it

Is the person choosing a native value, filtering by typing, or navigating a list?

Listbox

Shared trial context

A form asks the user to choose one value from a known option set before continuing.

Listbox

Mission

Listbox

Focus the list, reach Last 30 days with arrows, select it, and verify the selected state remains visible.

Last 7 days

Live result

Last 7 days is the only selected option. The list remains visible.

Step 1 of 3

Try

Try the component. Your live result appears just above. Move on at your own pace.

Behavior and edge case
What to observe
All four presets remain visible; the selected row is highlighted and reflected in the status. This native specimen has no separate active-versus-committed state.
Edge case
A disabled custom range is announced, skipped when required by the keyboard model, and never mistaken for the selected value.

What this example shows

Listbox is the composite option widget and can be standalone or a popup with single or multiple selection; Select is a native form control, while Combobox is the value control that owns or controls an associated popup.

Which fits your need?

Listbox

One or more values are chosen from a named composite option set

Select

Choosing one or more known values from a predefined list

Which component will you use here?
Difference and sources

Listbox is the composite option widget and can be standalone or a popup with single or multiple selection; Select is a native form control, while Combobox is the value control that owns or controls an associated popup.

Read the sources

    Parts of the specimen

    Select a numbered marker on the schematic, or use the list below, to see its role. The schematic shows the concept's representative state.

    Label

    The persistent text that names a control or field.

    Position in the atlas

    Relationship map

    Locate the chapter, neighboring concepts, and the next useful decision.

    • Chapter

      Choose from a list

      Listbox belongs to this comparison group.

    • Do not confuse

      Select

      Choose Listbox if the options need custom rendering, stay visible, or support multiple selection with keyboard patterns you control. Choose Select if a known set of values fits a plain form field and native behavior is enough.

      Compare this pair
    • Do not confuse

      Combobox

      Choose Listbox if the options stay visible on the page or if several may be selected at once. Choose Combobox if the user types or filters to reach a value and the options appear only on demand.

      Compare this pair
    • Next step

      Compare the concepts in the chapter before choosing an implementation.

      Open the chapter

    In your own words

    Understand

    What people describe

    Documented aliases: option list, selection list, multi-select list

    • keep all choices visible in a box
    • a selectable list that does not collapse
    • use arrows to move through visible options
    • choose one item from a permanent list
    • a box of options with the selected row highlighted
    • show several choices at once for comparison

    Choose

    Use it when

    • One or more values are chosen from a named composite option set
    • Keyboard users benefit from rapid option-to-option navigation

    Avoid it when

    • Screen space is scarce and a native Select is sufficient
    • Items are commands instead of values

    Compare

    Compare similar concepts

    Verification checklist

    Try these actions in the lab, then check the same behaviours in your agent’s result. Adapt the example names to your interface.

    1. 1. Do this

      Reach the visible list with Tab and move among options with the arrow keys.

      Expected result

      The list acts as one keyboard stop; the active option is visible and follows the control’s declared selection behavior.

    2. 2. Do this

      Choose two different options in turn, using the documented multiple-selection command if multiple choice is supported.

      Expected result

      A single-choice list keeps one selected value; a multiple-choice list changes only the intended selections.

    3. 3. Do this

      Try an unavailable option, then press Tab to leave the list.

      Expected result

      The unavailable option cannot become a selected value, and Tab reaches the next control without trapping you in the list.

    Full contract
    1. 1Options belong to one named list, whether standalone or used as a popup
    2. 2The relationship between focus and selection is declared, including whether selection follows focus
    3. 3Arrow, Home, and End behavior is consistent
    4. 4The selection mode is explicit

    Understand → Recognize → Choose → Compare

    Pack for your agent

    Pre-written instructions to paste into your agent. Copying executes nothing.

    Implement correctly

    Build Listbox without breaking its behavior

    # Implement Listbox in your agent
    
    ## Objective
    Implement Listbox for this verified behavior: A composite widget of named options that supports one or multiple selections and can be standalone or used as a combobox popup.
    
    ## Prerequisites
    - Inspect the repository, design system, and existing tests first.
    - Preserve unrelated changes and keep the file scope bounded.
    - Confirm that Listbox matches the need before writing code.
    
    ## Required behavior
    - Arrow keys navigate according to the declared control model; focus and selection states are exposed consistently, including when selection follows focus.
    - The control exposes whether one or multiple values can be selected and updates every selected state consistently.
    
    ## States to cover
    - Default preset selected
    - Last 30 days selected
    
    ## Accessibility
    - ARIA role: listbox > option
    - The primary control or named region for Listbox has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    - The native sized select is one tab stop. In this single-select specimen, selection follows keyboard focus, so active and selected state move together; custom listboxes must declare their own model.
    - In this standalone specimen, leaving with Tab preserves the selected value; when a listbox is a popup, dismissal is coordinated by its owning control.
    - The list name, four-option count, selected state, disabled state, and this specimen's single-selection mode are exposed by native semantics.
    - Tab enters the composite control once
    - In this native single-select specimen, arrow navigation updates selection as focus moves
    - There is no separate commit command in this specimen
    - Platform-supported Home and End keys reach boundaries
    
    ## When not to use
    - Screen space is scarce and a native Select is sufficient
    - Items are commands instead of values
    
    ## Acceptance criteria
    - Options belong to one named list, whether standalone or used as a popup
    - The relationship between focus and selection is declared, including whether selection follows focus
    - Arrow, Home, and End behavior is consistent
    - The selection mode is explicit
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The need is tied to canonical behavior before any technical choice.
    • States, accessibility, and non-goals prevent a merely visual implementation.
    • Acceptance criteria and the output format make verification observable.

    Try next

    Verify Listbox on a real journey

    # Verify Listbox after implementation
    
    ## Objective
    Audit the Listbox implementation against its behavior, states, and accessibility requirements without changing it automatically.
    
    ## Checks
    - Replay the smallest representative journey.
    - Check keyboard behavior, focus, accessible name, and announcements.
    - Tie each gap to a specific acceptance criterion.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:1af496920d6ad89f44563ae70e70b921be1fc7525384891cd41d25fa930a50d6

    Diagnose a problem

    Find and fix the Listbox defect

    # Debug Listbox in your agent
    
    ## Observed symptom
    [DESCRIBE THE SYMPTOM HERE]
    
    ## Observable checks
    - Reproduce the issue with the smallest relevant journey.
    - Compare behavior with the documented states and transitions for Listbox.
    - Verify keyboard behavior, focus, accessible name, and announcements.
    
    ## Possible causes
    - The chosen primitive does not match the expected behavior.
    - A state, transition, or focus return is missing.
    - A neighboring component captures an event or hides an accessible signal.
    
    ## Bounded corrections
    - Fix the reproduced cause without recreating neighboring components.
    - Preserve the public contract and add a focused regression test.
    - Do not install dependencies or change remote state without authorization.
    
    ## Final verification
    - Options belong to one named list, whether standalone or used as a popup
    - The relationship between focus and selection is declared, including whether selection follows focus
    - Arrow, Home, and End behavior is consistent
    - The selection mode is explicit
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    
    • Web platform
    • Requires · Access to the repository, design system, and tests
    Why it works
    • The explicit symptom prevents starting from an assumed fix.
    • Checks separate behavior, accessibility, and neighboring interference.
    • The fix stays bounded and must produce regression evidence.

    Try next

    Lock in the Listbox fix

    # Prevent the Listbox regression
    
    ## Objective
    Turn the reproduced cause into a focused regression test and compare Listbox with neighboring concepts before widening the fix.
    
    ## Checks
    - Prove that the test fails before the fix.
    - Prove that it passes after the bounded fix.
    - Verify that no neighboring component changed behavior.
    
    ## Guardrails
    - Show the proposed changes before any external action.
    - Do not publish, send, delete, pay for, or change remote state without explicit authorization.
    - Preserve unrelated changes and stop if the scope becomes ambiguous.
    
    ## Output format
    - Outcome or verdict.
    - Files or actions involved.
    - Checks run and observable evidence.
    - Remaining blockers or limitations.
    

    sha256:7ec54a406b38d4149bd896328860494ebbb8e705fe5494baf4918f9cc4e8db9c

    Full entry, saving and provenance

    Pre-written instruction by SkillCodex — your request is neither sent nor used to adapt this text; no content is generated, and copying executes nothing.

    Pack digest: sha256:e486df5947f663b803a86263d491d963ec550e873ddd785d7fdd8901182776f6

    In code

    TechnologyPrimitiveVersionCaveat
    Web platform

    select[size]

    NativeThe specimen uses a native sized select. A custom ARIA listbox requires complete option navigation and selection behavior.

    Technical details

    Behaviors

    • Navigate options

      Arrow keys navigate according to the declared control model; focus and selection states are exposed consistently, including when selection follows focus.

    • Declare the selection mode

      The control exposes whether one or multiple values can be selected and updates every selected state consistently.

    States

    • Default preset selected

      Default preset selected

    • Last 30 days selected

      Last 30 days selected

    State transitions

    • Default preset selected → Last 30 days selected

      In this native single-select specimen, arrow navigation reaches Last 30 days and immediately updates the selected value.

    • Last 30 days selected → Default preset selected

      In this native single-select specimen, navigation returns to the default preset and immediately updates the selected value.

    Test scenarios

    Context
    A report builder shows four visible date presets and lets the user choose exactly one.
    Mission
    Focus the list, reach Last 30 days with arrows, select it, and verify the selected state remains visible.
    Primary state
    All four presets remain visible; the selected row is highlighted and reflected in the status. This native specimen has no separate active-versus-committed state.
    Edge case
    A disabled custom range is announced, skipped when required by the keyboard model, and never mistaken for the selected value.

    Visual signals

    • Options grouped in one composite surface
    • One or more selected options have persistent states
    • The surface can be standalone or appear as an associated popup

    Behavioral signals

    • Arrow keys move within one composite control
    • Selection can follow focus or require explicit commit
    • Single or multiple selection is declared

    Accessibility

    Role
    listbox > option
    Accessible name
    The primary control or named region for Listbox has a stable accessible name from visible text or an explicit programmatic label; placeholder text and tooltips are not names.
    Focus
    The native sized select is one tab stop. In this single-select specimen, selection follows keyboard focus, so active and selected state move together; custom listboxes must declare their own model.
    Dismissal
    In this standalone specimen, leaving with Tab preserves the selected value; when a listbox is a popup, dismissal is coordinated by its owning control.
    Scroll
    A long option collection scrolls without moving the page behind it, and the active or selected option stays visible.
    Announcement
    The list name, four-option count, selected state, disabled state, and this specimen's single-selection mode are exposed by native semantics.
    Keyboard
    • Tab enters the composite control once
    • In this native single-select specimen, arrow navigation updates selection as focus moves
    • There is no separate commit command in this specimen
    • Platform-supported Home and End keys reach boundaries

    Bindings

    Open the HTML, ARIA, Radix, and shadcn matrix
    • select[size]

      implementationKind
      native
      nativeElement
      select[size]
      ariaPattern
      listbox
      radixPrimitive
      Not applicable
      shadcnRecipe
      Not applicable
      runtimeDependency
      Not applicable
      packageName
      Not applicable
      exportName
      Not applicable
      exactVersion
      Not applicable
      status
      verified
      sourceId
      source-ui-html-select
      deprecationStatus
      active
      replacement
      Not applicable
      validFrom
      Not applicable
      validUntil
      Not applicable

      Equivalence caveat: The specimen uses a native sized select. A custom ARIA listbox requires complete option navigation and selection behavior.

      Verify binding source

    Sources

    • WAI-ARIA APG: Listbox Pattern
      sourceId
      source-ui-aria-listbox
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/ARIA/apg/patterns/listbox/
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-09T07:07:36Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:7d0369bdd2fb3122cb1164a16ea1cb0b36960aaf5cc4e24e9c2bdedd888f050e
      status
      verified

      Claim covered: Listbox: informative APG guidance for the listbox pattern: roles, states, relationships, and keyboard interaction.

    • WHATWG HTML: The select element
      sourceId
      source-ui-html-select
      kind
      standard
      canonicalUrl
      https://html.spec.whatwg.org/multipage/form-elements.html#the-select-element
      publisher
      WHATWG
      sourceRevision
      http-last-modified:2026-07-19T13:52:46Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:418a8f9ce1e8690c6d458121120b0b3b7cd907aa92b2101b85f82f7e02d5ac2f
      status
      verified

      Claim covered: Listbox: normative native semantics, states, attributes, and browser behavior for select.

    • WAI-ARIA 1.2: Roles Model
      sourceId
      source-ui-wai-aria-roles
      kind
      standard
      canonicalUrl
      https://www.w3.org/TR/wai-aria-1.2/#roles
      publisher
      W3C WAI
      sourceRevision
      W3C-REC-wai-aria-1.2-20230606
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:c0fea16fc747779569ab754d2d25bca3e2b7e8a673b8ef5362aeb9ebc73a4849
      status
      verified

      Claim covered: Listbox: normative ARIA role definitions and constraints for the stated accessible role.

    • WCAG 2.2: Focus Appearance
      sourceId
      source-ui-wcag-understanding-focus-appearance
      kind
      documentation
      canonicalUrl
      https://www.w3.org/WAI/WCAG22/Understanding/focus-appearance.html
      publisher
      W3C WAI
      sourceRevision
      http-last-modified:2026-07-02T10:07:49Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:fdcf316a1f0e3cc758eda9618322d132862124ff0a3f3b1a3acbf20daf804ff0
      status
      verified

      Claim covered: Listbox: informative WCAG guidance for evaluating visible keyboard focus appearance.

    • WHATWG HTML: Forms
      sourceId
      source-ui-html-forms
      kind
      standard
      canonicalUrl
      https://html.spec.whatwg.org/multipage/forms.html
      publisher
      WHATWG
      sourceRevision
      http-last-modified:2026-07-19T13:52:46Z
      consultedAt
      2026-07-19
      license
      Not stated
      contentDigest
      sha256:730c20c8a823ab6b9a40c77d4731d6aab46895cd98c388fe12c966096d5bdd18
      status
      verified

      Claim covered: Listbox: normative native semantics, states, attributes, and browser behavior for HTML form controls.