Skip to content

HyList

Usage examples on this page are written for Lit / plain HTML (<hy-list>). The same component ships as HyList in @whitespaceux/harmony-react (native React 19), with typed wrappers for Angular, Solid, Svelte, and Vue. The API reference below applies to all frameworks.

A vertical list of items for display, navigation, or selection.

When to Use This Component

Use hy-list for:

  • Displaying lists of items, options, or content
  • Navigation menus and listboxes with selectable options
  • Settings panels with multiple choices

Don't use this for:

  • Action menus, value pickers, or any overlay-triggered selection → Use <hy-menu-button> with <hy-menu-item> / <hy-menu-item-radio> / <hy-menu-item-checkbox> instead.
  • Simple form inputs → Use <hy-select> instead.

Size Variants

  • small: Compact design with body-sm typography
  • medium: Default size with body-md typography (default)
  • large: Prominent design with body-lg typography

Role Behavior

The list automatically sets the appropriate role on child list-items based on its own role:

  • role="listbox" → child items get role="option"
  • role="menu" → child items get role="menuitem"
  • role="list" → child items get role="listitem"

Examples

Basic List

html
<hy-list>
  <hy-list-item value="1" primary-text="Item 1"></hy-list-item>
  <hy-list-item value="2" primary-text="Item 2"></hy-list-item>
</hy-list>

API

Properties

PropertyAttributeTypeDefaultDescription
ariaLabelaria-labelstringAccessible label for the list
ariaLabelledByaria-labelledbystring | undefinedID of element that labels the list
ariaDescribedbyaria-describedbystring | undefinedID of element that describes the list
rolerole'list' | 'listbox' | 'menu' | 'group''list'ARIA role for the list (list, listbox, menu, or group)
selectionModeselection-mode'none' | 'single' | 'multiple''none'Selection mode: none, single, or multiple
sizesize'small' | 'medium' | 'large''medium'Size variant for list items
disableddisabledbooleanfalseDisables the entire list
requiredrequiredbooleanfalseMarks the list as required for form validation
densedensebooleanfalseEnables dense/compact spacing
borderedborderedbooleanfalseShows border around the list
selectedValuesselected-valuesstring[][]Array of currently selected item values
listIdlist-idstring''ID for the list element. Defaults to auto-generated ID.

Events

EventDetailDescription
selection-changeFired when selection changes

Slots

SlotDescription
defaultThe list's items (hy-list-item elements)

CSS Parts

PartDescription
baseThe list's base <ul> element

Built with Lit. Documented with VitePress.