List contents
The first row of the party menu shows a head for each member. When someone joins, another head appears at the end; when someone leaves, the others move up and the last slot empties.
What changes is a whole group of slots. Writing a separate item per slot and updating each one is tedious, and when the party size changes, the mapping between slots and players falls apart.
What filling slots from a list doesâ
addIngredient(identifier, list, toElement) binds a list Signal to every slot of an identifier in the template. Item n of the list, converted by toElement, goes into the nth occurrence of the identifier.
When the list changes, the slots follow: new entries fill in at the end, removals shift later entries forward, and leftover slots are cleared. Both ListSignal and Signal<List<T>> can be passed directly.
Party membersâ
The party stores names here; real projects should store UUIDs and look up names in toElement.
Only Alice is in the party.
MutableListSignal<String> party = ListSignal.of();
party.add("Alice");
Pane pane = Pane.builder("MMMMM####")
.addIngredient('M', party, name ->
Element.item(Item.simple(named(Material.PLAYER_HEAD, name)))
)
.build();
Window.builder(pane).setTitle("My party").open(viewer);
// later, when the party changes, only change the list
party.add("Bob"); // Bob appears in the second slot
party.add("Carol"); // Carol appears in the third slot
party.remove("Alice"); // the others move up and the third slot empties

party | [Alice] |
|---|
Showing online playersâ
Signals.onlinePlayers() is a list Signal too and can fill slots directly; the slots update as players join and leave.
Pane pane = Pane.builder("MMMMMMMMM")
.addIngredient('M', Signals.onlinePlayers(), player ->
Element.item(Item.simple(named(Material.PLAYER_HEAD, player.getName())))
)
.build();
With more than nine players online, only the first nine show; use pagination or scrolling for more.
Caveatsâ
toElement converts one entry into the Element for its slot and must not return null. The first conversion runs on the thread calling build(), and later updates run on Sparrow UI's async worker executor. Only handle prepared data in it; do not read player inventories, the world, or other state that needs the owning thread.
If your code already has a suitable Executor, pass it as the fourth argument, addIngredient('M', party, toElement, executor), and later conversions run there; the first still runs on the building thread.
When the list is longer than the slots, only the part that fits is shown.
private static ItemStack named(Material material, String name) {
ItemStack stack = new ItemStack(material);
stack.setData(DataComponentTypes.CUSTOM_NAME,
Component.text(name).decoration(TextDecoration.ITALIC, false)
);
return stack;
}
It uses Paper's DataComponentTypes with Adventure's Component and TextDecoration, matching Item rendering.