Table
View OriginalTables display structured data in rows and columns. Supports static, sortable, lazy-loaded, paginated, and infinite scroll variants.
Goshtoso Component
Go + TemplDefault Table
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@gmail.com | Silver |
| 2338 | Bob Johnson | johnson.bob@outlook.com | Gold |
| 2342 | Sarah Adams | s.adams@gmail.com | Gold |
Striped Table
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
| 2345 | Alex Martinez | alex.martinez@penguinui.com | Gold |
| 2346 | Ryan Thompson | ryan.thompson@penguinui.com | Silver |
| 2349 | Emily Rodriguez | emily.rodriguez@penguinui.com | Gold |
Table with Action
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@gmail.com | |
| 2338 | Bob Johnson | johnson.bob@outlook.com | |
| 2342 | Sarah Adams | s.adams@gmail.com |
Table with Checkbox
| CustomerID | Name | Membership | ||
|---|---|---|---|---|
| 2335 | Alice Brown | alice.brown@gmail.com | ||
| 2338 | Bob Johnson | johnson.bob@outlook.com | ||
| 2342 | Sarah Adams | s.adams@gmail.com |
Users Table
| User | ID | Member Since | Status | Action |
|---|---|---|---|---|
Alice Brown alice.brown@gmail.com | 2335 | Nov 14, 2021 | Active | |
Bob Johnson johnson.bob@penguinui.com | 2338 | Aug 20, 2020 | Active | |
Ryan Thompson ryan.thompson@penguinui.com | 2346 | Feb 5, 2022 | Canceled | |
Emily Rodriguez emily.rodriguez@penguinui.com | 2349 | Jun 14, 2022 | Active | |
Alex Martinez alex.martinez@penguinui.com | 2345 | Sep 17, 2018 | Active |
Sortable Table (click headers)
Click column headers to sort. Uses HTMX to fetch sorted data from the server.
CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
| 2345 | Alex Martinez | alex.martinez@penguinui.com | Gold |
| 2346 | Ryan Thompson | ryan.thompson@penguinui.com | Silver |
| 2349 | Emily Rodriguez | emily.rodriguez@penguinui.com | Gold |
Lazy-Loaded Table
Table body loads from the server via HTMX on page load.
| CustomerID | Name | Membership | |
|---|---|---|---|
Loading... | |||
Paginated Table
Navigate between pages with HTMX-powered pagination controls.
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
Page 1 of 4
Filtered Table
Search and filter table data with HTMX-powered filter controls.
CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
Page 1 of 4
Inline Filter Variant
Same filter controls, no bordered block, no collapsible toggle. Suitable for modal bodies or toolbar strips where the host already provides chrome.
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
Page 1 of 4
Infinite Scroll Table
Scroll down in the container to automatically load more rows via HTMX.
| CustomerID | Name | Membership | |
|---|---|---|---|
| 2335 | Alice Brown | alice.brown@penguinui.com | Silver |
| 2338 | Bob Johnson | johnson.bob@penguinui.com | Gold |
| 2342 | Sarah Adams | s.adams@penguinui.com | Gold |
Usage Example
// Default Table
@table.Table(table.Config{
Columns: []table.Column{
{Key: "id", Label: "CustomerID"},
{Key: "name", Label: "Name"},
{Key: "email", Label: "Email"},
{Key: "membership", Label: "Membership"},
},
Rows: rows,
})
// Sortable Table (HTMX)
@table.Table(table.Config{
ID: "sortable",
HTMXEndpoint: "/api/components/table/rows",
Columns: []table.Column{
{Key: "id", Label: "CustomerID", Sortable: true},
{Key: "name", Label: "Name", Sortable: true},
{Key: "email", Label: "Email"},
{Key: "membership", Label: "Membership", Sortable: true},
},
SortBy: "id",
SortDir: table.SortAsc,
Rows: rows,
})
// Lazy-Loaded Table (HTMX)
@table.Table(table.Config{
ID: "lazy",
HTMXEndpoint: "/api/components/table/rows",
LazyLoad: true,
Columns: columns,
})
// Paginated Table
@table.Table(table.Config{
ID: "paginated",
HTMXEndpoint: "/api/components/table/rows",
Columns: columns,
Rows: rows,
Pagination: &table.PaginationConfig{CurrentPage: 1, TotalPages: 4, PerPage: 3},
})
// Infinite Scroll Table
@table.Table(table.Config{
ID: "infinite",
HTMXEndpoint: "/api/components/table/rows?variant=infinite",
Columns: columns,
Rows: rows,
Pagination: &table.PaginationConfig{
Mode: table.PaginationInfiniteScroll,
CurrentPage: 1,
PerPage: 3,
HasMore: true,
ContainerHeight: "300px",
},
})