Column toolbar
Since 1.6.0
The columnToolbar option is available since 1.6.0.
Turn on columnToolbar and a strip with one chip per column appears above (or below) the grid. You can show, hide and reorder columns without opening the column menu in a header.
const options: GridOptions<Member> = {
columns,
rows,
rowKey: 'id',
columnToolbar: true, // or { position: 'bottom', showLabels: false }
};| Setting | Default | Description |
|---|---|---|
columnToolbar | false | true, or { position, showLabels }. |
position | 'top' | 'top' puts the strip above the grid, 'bottom' below it. |
showLabels | true | With false only the eye icon shows and the title is used as the accessible name. |
Using it
- Press a chip (Space and Enter too): shows or hides the column. A hidden chip is dimmed and has
aria-pressed="false". It works likesetColumnVisible, socolumnVisibilityChangedfires. - Drag a chip (mouse, touch or pen): moves the column to where you drop it. It uses the existing
moveColumn, so the move animation and thecolumnMovedevent stay the same. - Alt+Left/Right on a focused chip moves the column one place (the directions flip in
rtl). Plain Left/Right moves focus between chips, and Home and End go to the first and last chip. - Locked columns (
locked) only block what they lock:locked: { visible: true }makes the chiparia-disabled, andlocked: { position: true }blocks dragging and moving. - A pinned column moves only inside its own pinned zone, even from a chip.
Accessibility and language
The strip has role="toolbar" and the chips are buttons. Only one chip is in the tab order (roving tabindex), and the arrow keys move between them. Chip and strip names follow locale (Korean, English) and the language packs (Japanese, Chinese), and you can override them with columnToolbarLabel, columnToolbarShow, columnToolbarHide and columnToolbarMove in messages. Dark theme, right-to-left direction and narrow widths (chips wrap) are supported.
Using it with other features
With pagination the pager sits outside the strip (top: pager → toolbar → grid). The chip of a column hidden by responsive columns is shown in italics. Columns in a collapsed header group stay folded whatever their chip says.
Examples: Hide and reorder columns with the column toolbar, Use the toolbar with header groups and a pinned column