LyteNyte Grid logo for light mode. Links back to the documentation home page.
Columns

Column Floating Header

LyteNyte Grid's floating row is a specialized header row that appears below the main column headers.

Floating header rows let you render custom components for each column. While often used for filtering components, it can render any type of component.

Enable the floating row by setting the floatingRowEnabled property on the grid state. Once enabled, each column can define a floating cell renderer through the floatingCellRenderer property.

The floatingCellRenderer may be:

  • A React component that LyteNyte Grid renders as the floating cell.
  • A string referencing a registered floating cell renderer defined on the grid's floatingCellRenderers property.

Floating Component Renderer

When the floating row is enabled, LyteNyte Grid uses each column's floatingCellRenderer to decide what to render in the floating cell. The demo below shows a simple renderer that provides a basic text filter input.

Column Floating Cell

In the demo, the floating row renders as a normal Grid.HeaderCell component. LyteNyte Grid determines whether a header cell belongs to the main header or the floating row based on the cell property supplied by the view layout:

<Grid.HeaderCell cell={c} />

The cell object has a kind value:

  • "cell" for a normal header cell.
  • "floating" for a floating header cell.

See the Grid View API reference for more details.

Floating Registered Renderer

If floatingCellRenderer is a string, LyteNyte Grid treats it as a lookup key into the grid's floatingCellRenderers registry. The demo below shows the same example as above, but using a registered renderer instead of an inline component:

Column Floating Cell Registered

String-based renderers are helpful when column definitions must be serializable. In other cases, prefer using component-based renderers.

const grid = Grid.useLyteNyte({
// Other grid props...
floatingRowEnabled: true,
floatingCellRenderers: { "string-filter": FloatingFilter },
columnBase: {
floatingCellRenderer: "string-filter",
},
});

Floating Row Visibility Toggling

You can show or hide the floating row by toggling the floatingRowEnabled state. The demo below includes a switch that updates this state:

Floating Cell Visibility

The toggle simply flips the floatingRowEnabled value:

<SwitchToggle
label="Toggle Floating Row"
checked={grid.state.floatingRowEnabled.useValue()}
onChange={() => {
grid.state.floatingRowEnabled.set((prev) => !prev);
}}
/>

Next Steps

  • Column Resizing: Change column widths programmatically or through user interaction.
  • Column Moving: Reorder columns programmatically or via drag-and-drop.
  • Column Base: See the default column values and how to override them with the columnBase property.
  • Column Header Height: Adjust the height of the header row, group header rows, or the floating header row.