Skip to content

Header Actions

A table's header actions are simply actions that sit within the header of your table.

Getting Started

A table definition can accept a list of header actions as so:

go
Table(driver).
    HeaderActions(
        HeaderAction("my-action").
            Style(config.ButtonStyleGhost).
            Icon(icons.Search).
            Callback(func(ctx *context.TableContext[models.Appointment]) {
                fmt.Println("You click a button on the table!")
            })
    )
    // Here we've created a header action that when clicked
    // will set the search field of the table to licorice.
    // We do this by using the table's search variable defined 
    // by it's alpine data component :)

Methods

Header actions support the common action configuration methods you can learn more about here:

Table Context

The ctx of a header action is the TableContext struct. It will give you general information about the current state of your table like the active filters, search, etc.

Limitations

The values in TableContext are static and do not react to your changes. We'll eventually add support for updating filters and searching server-side. Right now, we only have support for mutating these via a button client side. See more here:

Released under the MIT License.