Package org.patternfly.component.table


package org.patternfly.component.table
Provides table components for displaying structured data in rows and columns.

This package contains a composable table implementation with support for captions, header rows, body rows, selection (single and multi), compact and borderless variants, tree tables, and wrapping options. Tables are built using standard HTML table semantics (thead, tbody, tr, th, td).

Key Classes

  • Cell - Base class for table cells (Th and Td)
  • Table - Main table component
  • TableCaption - Table caption
  • TableText - Wrapped/truncated cell text
  • TableType - Enumeration of table types (table, tree table)
  • Tbody - Table body section
  • Td - Table data cell
  • Th - Table header cell
  • Thead - Table header section
  • TitleCell - Title cell for tree table rows with expand/collapse toggle
  • Tr - Table row
  • TreeViewGridBreakpoint - Responsive breakpoints for tree view grid layout
  • Wrap - Enumeration of text wrapping options for table cells

Usage

Create a basic table with a caption, header row, and data rows:

import static org.patternfly.component.table.Table.table;
import static org.patternfly.component.table.TableCaption.tableCaption;
import static org.patternfly.component.table.Tbody.tbody;
import static org.patternfly.component.table.Td.td;
import static org.patternfly.component.table.Th.th;
import static org.patternfly.component.table.Thead.thead;
import static org.patternfly.component.table.Tr.tr;

Table table = table()
        .addCaption(tableCaption().text("Repositories"))
        .addHead(thead()
                .addRow(tr("head")
                        .addItem(th("name").text("Name"))
                        .addItem(th("branches").text("Branches"))
                        .addItem(th("prs").text("Pull requests"))))
        .addBody(tbody()
                .addRow(tr("row-0")
                        .addItem(td("Name").text("Repository 1"))
                        .addItem(td("Branches").text("10"))
                        .addItem(td("Pull requests").text("25"))));

Create a compact table without borders:

import static org.patternfly.component.table.Table.table;

Table compact = table().compact(true).noBorders(true);
See Also:
  • Class
    Description
    Base class for table cells in a Table component.
    A table is used to display large data sets that can be easily laid out in a simple grid with column headers.
    A caption element for a Table component.
    A text wrapper element within a Table cell.
    Defines whether a Table uses a flat grid or tree grid ARIA role.
    A table body section within a Table component.
    A data cell within a table row in a Table component.
    A header cell within a table row in a Table component.
    A table header section within a Table component.
    A title cell with expandable toggle support in a tree view Table.
    A table row within a Table component.
    Union enum of the different treeViewGridBreakpoint properties for a tree view table.
    Defines the text wrapping behavior for Table cells.