# SelectList

> SelectList is a scrolling list of rows with at most one selected, like the world list, for picking an item that buttons then act on.

URL: https://xichil.dev/docs/xis-mvui/v1/widgets/select-list/ · Updated: 2026-11-06 · Applies to: Fabric, Quilt, Legacy Fabric, Forge, NeoForge, MC 1.7.10 - 26.3

A scrolling list of rows of text, at most one of them selected, like vanilla's world or server lists. The rows
come from a supplier, so the list follows your data; the selection lives in the entry.

```java
SelectList profiles = SelectList.builder("profiles")
        .rows(() -> {
            List<SelectList.Row> rows = new ArrayList<>();
            for (Profile p : store.profiles()) {
                rows.add(SelectList.Row.of(p.id(), Text.literal(p.name())));
            }
            return rows;
        })
        .build();

Button delete = Button.builder("delete")
        .label(Text.translatable("mymod.delete", "Delete"))
        .enabled(() -> profiles.selected() != null)
        .onPress(() -> store.delete(profiles.selected()))
        .build();
```

## Builder

| Method | Required | Default | Notes |
| --- | --- | --- | --- |
| `rows(Supplier<List<SelectList.Row>>)` | yes | | the rows in display order; re-read on every refresh. Return a fresh list each time. |
| `onSelect(Consumer<String>)` | no | does nothing | called with the row id when the player selects a row; main thread |
| `enabled`, `tooltip`, `visible` | no | | [options every widget has](https://xichil.dev/docs/xis-mvui/v1/widgets/index.md#options-every-widget-has) |

`SelectList.Row.of(id, text)` makes a row: `id` is how your code knows it, `text` is what is shown.

## Methods

| Method | Does |
| --- | --- |
| `selected()` | the selected row's id, or `null` |
| `select(rowId)` | selects a row and calls `onSelect`, as a click does; `select(null)` clears the selection |
| `rows()` | the current rows |

## Behaviour

- Nothing is selected at first.
- When the selected row disappears from the rows, the selection is cleared, without calling `onSelect`.
- Row ids must be unique within the list. A duplicate throws when the rows are read, and since that happens in
  your supplier, it turns your menu off ([Failure isolation](https://xichil.dev/docs/xis-mvui/v1/concepts/failure-isolation/index.md)). Use stable,
  unique ids such as database keys or file names.
- Actions usually read `selected()` rather than tracking `onSelect`.
- **Footer:** yes.

## Test it

```java
host.select("profiles", "p1");
host.click("delete");
```

Rendered as `[list profiles]` followed by one line per row, `> p1: Default` for the selected row.

## See also

- Javadoc: [SelectList](https://xichil.dev/javadoc/xis-mvui/v1/dev/xichil/mvui/SelectList.html), [SelectList.Row](https://xichil.dev/javadoc/xis-mvui/v1/dev/xichil/mvui/SelectList.Row.html)
- [A list manager](https://xichil.dev/docs/xis-mvui/v1/examples/list-manager/index.md)
