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

Column Visibility

Learn how to manage column visibility in LyteNyte Grid and understand the difference between hidden columns and collapsed column groups.

LyteNyte Grid supports defining columns that are initially hidden. Developers can toggle column visibility during runtime. The grid also supports column groups, allowing related columns to be shown or hidden together.

Hiding Columns

Each column in LyteNyte Grid has a hide property in its specification. This property defaults to false. When set to true, the grid does not render the column in the viewport. The grid still includes the column internally, and queries against grid state will continue to return it.

In the demo below, the Network and Exchange columns start hidden. Clicking their pills toggles each column’s visibility. When a hidden column becomes visible, the grid inserts it based on its position in the column state.

Hiding Columns

Columns
Symbol
Network
Exchange
Change % 24h
Perf % 1W
Perf % 1M
Perf % 3M
Perf % 6M
Perf % YTD
Volatility
Volatility 1M
Fork code on stack blitzFork code on code sandbox

The demo uses the Pill Manager provided by LyteNyte Grid. Clicking a pill toggles the visibility of its corresponding column. Since columns are updated at runtime, their column definitions are stored in React state.

The Pill Manager is a versatile component that manages column visibility, ordering, grouping, and additional functions. See the Pill Manager guide for more details.

Warning

Avoid updating a column’s visibility too frequently. Each update triggers a layout recalculation and DOM update, which can be expensive when performed many times per second.

Column Group Visibility

A column group is a developer-defined collection of related columns. A group may be collapsed, causing certain columns to appear only when the group is open.

When the grid collapses a group, it hides the affected columns visually. However, this behavior differs from setting hide on a column specification. The grid still considers these columns logically visible. In other words, their visibility state remains true even though the collapsed group hides them in the UI.

The example below demonstrates this behavior. The Market Info group is collapsed, which hides the Network and Exchange columns. The Pill Manager still shows them as visible because the grid treats them as visible in state, even though the collapsed group hides them visually.

Column Group Visibility

Columns
Symbol
Network
Exchange
Change % 24h
Perf % 1W
Perf % 1M
Perf % 3M
Perf % 6M
Perf % YTD
Volatility
Volatility 1M
Fork code on stack blitzFork code on code sandbox

Note

Hiding the Symbol column or both the Exchange and Network columns makes the column group no longer collapsible. A column group can be collapsed only if at least one column is visible when the group is open and at least one column is visible when it is closed.

For more on column groups, see our Column Groups guide.

Next Steps

  • Column Resizing: Change column widths programmatically or via user interaction.
  • Column ID & Name: Define user-friendly column names and ensure unique IDs.
  • Column Moving: Reorder columns programmatically or through drag-and-drop.
  • Column Groups: Create a column header hierarchy and associate columns with column groups.