Egbe Lajo
COMPONENT

Table

Data table with sortable columns, hover rows, and responsive overflow. On mobile, replaced by ListItem + FlatList.

Default

NomeFuncaoStatusAcoes
Maria dos SantosEgbomiAtivo
Joao OliveiraOgaAtivo
Ana CostaIyawoPendente

Sortable Columns

Use sortable, sorted, and onSort on TableHeadto enable column sorting. The component renders the correct aria-sort attribute.

<TableHead
  sortable
  sorted={sortKey === "name" ? sortDir : false}
  onSort={() => toggleSort("name")}
>
  Nome
</TableHead>

API Reference

PropTypeDefaultDescription
sortablebooleanfalseEnable sort indicator and click handler
sorted"asc" | "desc" | falsefalseCurrent sort direction
onSort() => voidCalled when header is clicked
hoverablebooleantrueRow hover highlight (TableRow)

React Native (ListItem)

Tables don't work on mobile. Use ListItem inside FlatList instead. Each row becomes a tappable list item with leading avatar, trailing badge, and press feedback.

Mobile equivalent
import { ListItem, ListAvatar, Badge } from "@/components/mobile";
import { FlatList } from "react-native";

<FlatList
  data={members}
  keyExtractor={(item) => item.id}
  renderItem={({ item }) => (
    <ListItem
      title={item.name}
      subtitle={item.role}
      leading={<ListAvatar initials="MS" />}
      trailing={<Badge variant="success">Ativo</Badge>}
      onPress={() => navigate(item.id)}
    />
  )}
  removeClippedSubviews
  maxToRenderPerBatch={15}
  windowSize={7}
/>