tables

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultLimits = []int{5, 10, 25, 50}

DefaultLimits is a list of default limits.

Functions

func Next

func Next(p PaginationProps) htmx.Node

Next is a component that renders a next button.

func Pagination

func Pagination(p PaginationProps, children ...htmx.Node) htmx.Node

Pagination is a component that renders a pagination.

func Prev

func Prev(p PaginationProps) htmx.Node

Prev is a component that renders a previous button.

func Search(props SearchProps, children ...htmx.Node) htmx.Node

Search is a component that renders a search.

func Select

func Select(p PaginationProps, children ...htmx.Node) htmx.Node

Select is a component that renders a select.

func Table

func Table[S ~[]R, R Row](p Props, columns Columns[R], s S) htmx.Node

Table is a struct that contains the properties of a table.

func TablePagination

func TablePagination(p TablePaginationProps, children ...htmx.Node) htmx.Node

TablePagination is a component that renders a table pagination.

func TableToolbar

func TableToolbar(p TableToolbarProps, children ...htmx.Node) htmx.Node

TableToolbar is a component that renders a table toolbar.

Types

type ColumnDef

type ColumnDef[R Row] struct {
	// ID is the id of the column.
	ID string
	// AccessorKey is the accessor key of the column.
	AccessorKey string
	// Header is the header of the column.
	Header func(p Props) htmx.Node
	// Cell is the cell of the column.
	Cell func(p Props, row R) htmx.Node
	// EnableSorting is a flag to enable sorting.
	EnableSorting bool
	// EnableFiltering is a flag to enable filtering.
	EnableFiltering bool
}

ColumnDef returns a new column definition.

type Columns

type Columns[R Row] []ColumnDef[R]

Columns returns a new column definition.

type PaginationProps

type PaginationProps struct {
	// ID is the id of the table.
	ID string
	// Limit is the number of items to return.
	Limit int
	// Offset is the number of items to skip.
	Offset int
	// Target is the target of the pagination.
	Target string
	// Total is the total number of items.
	Total int
	// URL is the URL of the pagination.
	URL string
	// Limits is the list of limits.
	Limits []int

	htmx.ClassNames
}

PaginationProps is a struct that contains the properties of a pagination.

type Props

type Props struct {
	// ID is the id of the table.
	ID string
	// Pagination is the pagination of the table.
	Pagination htmx.Node
	// Toolbar is the toolbar of the table.
	Toolbar htmx.Node

	htmx.ClassNames
}

Props is a struct that contains the properties of a table.

type Row

type Row interface {
	comparable
}

Row is a struct that contains the properties of a row.

type SearchProps

type SearchProps struct {
	// ClassNames is a struct that contains the class names of a search.
	ClassNames htmx.ClassNames
	// Placehholder is the placeholder of the search.
	Placeholder string
	// URL is the URL of the search.
	URL string
	// Name is the name of the search.
	Name string
	// Value is the value of the search.
	Value string
}

SearchProps are the properties of a search.

type TablePaginationProps

type TablePaginationProps struct {
	ClassNames htmx.ClassNames
}

TablePaginationProps is a struct that contains the properties of a table pagination.

type TableToolbarProps

type TableToolbarProps struct {
	ClassNames htmx.ClassNames
}

TableToolbarProps is a struct that contains the properties of a table toolbar.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL