# \[aria-setsize\]

> The `aria-setsize` ARIA attribute defines the total number of items in a set.

## When do I need aria-setsize and aria-posinset?

The attribute that specifies the total number of items in a set, such as a list or menu. It helps users understand the size of the set and the number of items it contains.

- Topic: Relationship Attributes
- Type: attribute

## Example

Wrong:

```html
<ul role="listbox">
  <li role="option">Item 501</li>
  <li role="option">Item 502</li>
</ul>
```

Right:

```html
<ul role="listbox">
  <li role="option" aria-setsize="1000" aria-posinset="501">Item 501</li>
  <li role="option" aria-setsize="1000" aria-posinset="502">Item 502</li>
</ul>
```

With only part of the list rendered, these attributes give the real position and size.

## Common mistakes

- A virtualized list announced as '1 of 20' when it has 10,000 items.

## Key points

- `aria-setsize` is used only when not all items are in the DOM, like virtualized lists or feeds.
- `aria-setsize` is '-1' when the total is unknown, not a guess.
- Each item that has `aria-setsize` also has a matching `aria-posinset`.

## Interview questions

### Do I need aria-setsize on a normal list?

No. Browsers count the items when they are all in the DOM, so a plain `<ul>` already announces the size.

### Which roles support aria-setsize?

Items like `listitem`, `option`, `treeitem`, `menuitem`, `tab`, `radio`, `article` and `row` in a treegrid.

## Related cards

- [\[aria-posinset\]](https://wonderium.dev/a11y/aria-posinset.md)
- [listbox](https://wonderium.dev/a11y/listbox.md)
- [option](https://wonderium.dev/a11y/option.md)
- [treeitem](https://wonderium.dev/a11y/treeitem.md)
- [list](https://wonderium.dev/a11y/list.md)

---

- Level: [Accessibility](https://wonderium.dev/a11y.md)
- HTML version: https://wonderium.dev/a11y/aria-setsize
- Last updated: 2026-11-25
