ARIA Widget Roles

ARIA role: treeitem

An item in a hierarchical tree, optionally containing a group of child items. Requires tree or group context inside a tree; use aria-expanded only for parent items. Static structure only; implement tree navigation. Explicit roles do not implement visual presentation, interaction or focus management; verify allowed role/element combinations in ARIA in HTML. Accessibility exposure varies with browser, platform and assistive technology. Test relevant combinations; rendering is not proof of accessibility.

Formal Syntax & Structure

html syntaxhtml
role="treeitem"

Parameters & Attributes

NameTypeDescription
roletokenExplicit role token treeitem; use only where allowed. Omit when native semantics match.
aria-expandedboolean or undefinedRelevant when applicable. Reports whether content controlled or owned by an element is expanded or collapsed. Use on the actual controlling widget; omit when it has no expandable content. It does not show or hide content automatically. Values: true, false, undefined.
aria-selectedboolean or undefinedRelevant when applicable. Indicates selection of an item in a widget rather than keyboard focus or the current navigation location. Keep the actual selection model synchronized and use false for selectable but unselected items as appropriate. Values: true, false, undefined.
aria-levelintegerRelevant when applicable. Specifies the hierarchical level of a heading, tree item, or other supported structure. For custom headings it is required; prefer native h1–h6. Do not derive levels from visual size; maintain logical hierarchy. Values: positive integer.
aria-posinsetintegerRelevant when applicable. Identifies an item's logical position when not all items in a set are present in the DOM. Pair with aria-setsize and ensure the position does not exceed a known size. Values: positive 1-based position.
aria-setsizeintegerRelevant when applicable. Indicates the total number of items in a logical set when only some appear in the DOM. Use -1 for unknown size. Pair with aria-posinset for each rendered member. Values: positive integer or -1.

Working Example

Example Snippethtml
<div role="tree" aria-label="Folders">  <div role="treeitem" tabindex="0">Notes</div></div>
HTML Reference