# TableComponent

A sortable data table with a sticky header.

```java
TableComponent<Pet> pets = add(new TableComponent<Pet>(at(new Box("pets", 8, 8, 280, 120)), 14)
        .column("Name", c -> c.text(Pet::name).weight(2)
                .comparator(Comparator.comparing(Pet::name, String.CASE_INSENSITIVE_ORDER)))
        .column("Age", c -> c.text(p -> p.age() + " d").fixed(44).align(TableComponent.Align.RIGHT)
                .comparator(Comparator.comparingInt(Pet::age)))
        .column("Mood", c -> c.renderer((d, theme, pet, cell, hovered, selected) ->
                d.fill(cell.x() + 3, cell.y() + 3, cell.right() - 3, cell.bottom() - 3, theme.palette().good())))
        .emptyText(words.get("mymod.pets.none"))
        .onSelect(this::show)
        .onActivate(this::open));
pets.setItems(allPets);
```

## Variants

- Rows

Page: https://minuit.dryaides.com/components/table.html
