Skip to main content

Toolbar & Layout

OGrid wraps your grid in a single bordered container with three sections: a toolbar strip, the grid area, and a footer. Every section is optional — the container adapts to what you enable.

Layout Anatomy

Toolbar Strip
toolbar·Custom buttons, search, status
columnChooser
toolbarBelow·Filter chips, breadcrumbs, secondary actions
Sidebar
sideBar
Columns panel
Filters panel
Data Grid
Column headers, rows, inline editing
statusBar·Row count, aggregations
Footer Strip
pagination·Page controls, page size selector

Every combination is valid — you can use just the grid, add a toolbar, add pagination, enable the sidebar, or use all of them together. The bordered container handles spacing and borders automatically.

Default Layout

With no extra props, OGrid renders a toolbar strip containing only the column chooser button on the right, plus the grid. Click the columns button to toggle column visibility.

Default layout — column chooser button in the toolbar strip
Live
Name
Email
Department
Salary
Status
Alice Johnson
alice@example.com
Engineering
$50,000
Active
Bob Smith
bob@example.com
Marketing
$53,500
Draft
Carol Lee
carol@example.com
Sales
$57,000
Archived
David Kim
david@example.com
Finance
$60,500
Active
Eve Torres
eve@example.com
Operations
$64,000
Draft
Frank Wu
frank@example.com
Engineering
$67,500
Archived
Grace Park
grace@example.com
Marketing
$71,000
Active
Henry Adams
henry@example.com
Sales
$74,500
Draft
Irene Costa
irene@example.com
Finance
$78,000
Archived
Jack Rivera
jack@example.com
Operations
$81,500
Active
Try it in your framework

The demo above uses Radix UI for styling. To see this feature with your framework's design system (Fluent UI, Material UI, Vuetify, PrimeNG, etc.), click "Open in online demo" below the demo.

import { OGrid } from '@alaarab/ogrid-react-radix';

<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
columnChooser="toolbar"
pagination
/>
Switching UI libraries

The OGrid component has the same props across all React UI packages. To switch, just change the import:

  • Radix (lightweight, default): from '@alaarab/ogrid-react-radix'
  • Fluent UI (Microsoft 365 / SPFx): from '@alaarab/ogrid-react-fluent' — wrap in <FluentProvider>
  • Material UI (MUI v7): from '@alaarab/ogrid-react-material' — wrap in <ThemeProvider>

Custom Toolbar Content

The toolbar prop places your content on the left side of the toolbar strip. The column chooser stays on the right. Use this for action buttons, search inputs, status text, or anything else.

Custom toolbar — buttons on the left, column chooser on the right
Live
25 rows
Name
Email
Department
Salary
Status
Alice Johnson
alice@example.com
Engineering
$50,000
Active
Bob Smith
bob@example.com
Marketing
$53,500
Draft
Carol Lee
carol@example.com
Sales
$57,000
Archived
David Kim
david@example.com
Finance
$60,500
Active
Eve Torres
eve@example.com
Operations
$64,000
Draft
Frank Wu
frank@example.com
Engineering
$67,500
Archived
Grace Park
grace@example.com
Marketing
$71,000
Active
Henry Adams
henry@example.com
Sales
$74,500
Draft
Irene Costa
irene@example.com
Finance
$78,000
Archived
Jack Rivera
jack@example.com
Operations
$81,500
Active
<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
toolbar={
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<button onClick={handleExport}>Export CSV</button>
<button onClick={handleSelectAll}>Select All</button>
<span>{data.length} rows</span>
</div>
}
columnChooser="toolbar"
pagination
/>

Secondary Toolbar Row

The toolbarBelow prop renders a secondary row below the primary toolbar strip. Use it for active filter chips, breadcrumbs, search bars, or any contextual content that should sit between the toolbar and the grid.

Secondary toolbar row with filter chips
Live
25 rows
Filters:Engineering ×Active ×
Name
Email
Department
Salary
Status
Alice Johnson
alice@example.com
Engineering
$50,000
Active
Bob Smith
bob@example.com
Marketing
$53,500
Draft
Carol Lee
carol@example.com
Sales
$57,000
Archived
David Kim
david@example.com
Finance
$60,500
Active
Eve Torres
eve@example.com
Operations
$64,000
Draft
Frank Wu
frank@example.com
Engineering
$67,500
Archived
Grace Park
grace@example.com
Marketing
$71,000
Active
Henry Adams
henry@example.com
Sales
$74,500
Draft
Irene Costa
irene@example.com
Finance
$78,000
Archived
Jack Rivera
jack@example.com
Operations
$81,500
Active
<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
toolbar={
<div style={{ display: 'flex', gap: 8, alignItems: 'center' }}>
<button onClick={handleExport}>Export CSV</button>
<span>{data.length} rows</span>
</div>
}
toolbarBelow={
<div style={{ display: 'flex', gap: 6, flexWrap: 'wrap' }}>
<span style={{ padding: '2px 8px', background: '#e0e0e0', borderRadius: 12, fontSize: 12 }}>
Department: Engineering ✕
</span>
<span style={{ padding: '2px 8px', background: '#e0e0e0', borderRadius: 12, fontSize: 12 }}>
Status: Active ✕
</span>
</div>
}
columnChooser="toolbar"
pagination
/>
tip

The secondary toolbar row shares the same background and border styling as the primary toolbar. It only renders when toolbarBelow is provided — no empty space when omitted.

Column Chooser Placement

The columnChooser prop controls where the column visibility control appears:

ValueBehavior
true or 'toolbar'Column chooser button in the toolbar strip (default)
'sidebar'Column chooser moves to the sidebar's Columns panel
falseHidden entirely — columns are locked

When columnChooser="sidebar", the column chooser button is removed from the toolbar. Instead, users toggle column visibility from the sidebar's Columns panel. This is useful when you have many columns and want a dedicated panel for managing them.

Sidebar mode — column chooser moves to the sidebar Columns panel
Live
Name
Email
Department
Salary
Status
Alice Johnson
alice@example.com
Engineering
$50,000
Active
Bob Smith
bob@example.com
Marketing
$53,500
Draft
Carol Lee
carol@example.com
Sales
$57,000
Archived
David Kim
david@example.com
Finance
$60,500
Active
Eve Torres
eve@example.com
Operations
$64,000
Draft
Frank Wu
frank@example.com
Engineering
$67,500
Archived
Grace Park
grace@example.com
Marketing
$71,000
Active
Henry Adams
henry@example.com
Sales
$74,500
Draft
Irene Costa
irene@example.com
Finance
$78,000
Archived
Jack Rivera
jack@example.com
Operations
$81,500
Active
<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
columnChooser="sidebar"
sideBar
pagination
/>
tip

The sidebar also includes a Filters panel with inline filter controls. Click the filter icon tab to switch panels.

Hidden

Set columnChooser={false} when you want to lock the visible columns and prevent users from changing them.

<OGrid
columns={columns}
data={items}
getRowId={(item) => item.id}
columnChooser={false}
/>

Full Layout

Here is every layout feature enabled at once — toolbar with custom buttons, column chooser, sidebar, cell selection with status bar aggregations, and pagination:

Full layout — toolbar, sidebar, status bar, and pagination together
Live
Full-featured layout
Name
Email
Department
Salary
Status
Alice Johnson
alice@example.com
Engineering
$50,000
Active
Bob Smith
bob@example.com
Marketing
$53,500
Draft
Carol Lee
carol@example.com
Sales
$57,000
Archived
David Kim
david@example.com
Finance
$60,500
Active
Eve Torres
eve@example.com
Operations
$64,000
Draft
Frank Wu
frank@example.com
Engineering
$67,500
Archived
Grace Park
grace@example.com
Marketing
$71,000
Active
Henry Adams
henry@example.com
Sales
$74,500
Draft
Irene Costa
irene@example.com
Finance
$78,000
Archived
Jack Rivera
jack@example.com
Operations
$81,500
Active
<OGrid
ref={gridRef}
columns={columns}
data={items}
getRowId={(item) => item.id}
columnChooser="toolbar"
sideBar
statusBar
cellSelection
pagination
toolbar={
<div style={{ display: 'flex', gap: 8 }}>
<button onClick={() => gridRef.current?.deselectAll()}>
Clear Selection
</button>
</div>
}
/>

Headings and Titles

The title prop is deprecated. Render headings outside the <OGrid> component for full control over styling:

<div>
<h1>Projects Dashboard</h1>
<p>Manage all active projects below.</p>
<OGrid columns={columns} data={projects} getRowId={(p) => p.id} />
</div>

Props

PropTypeDefaultDescription
toolbarReactNode--Custom content in the left side of the toolbar strip.
toolbarBelowReactNode--Secondary toolbar row below the primary toolbar (e.g. filter chips, breadcrumbs).
columnChooserboolean | 'toolbar' | 'sidebar'trueWhere to place the column chooser. true/'toolbar' = toolbar, 'sidebar' = sidebar panel only, false = hidden.
sideBarboolean | ISideBarDeffalseEnable sidebar panels. Required for columnChooser="sidebar".
statusBarbooleanfalseShow status bar below the grid with row counts and aggregations.
paginationboolean | IPaginationPropsfalseShow pagination in the footer strip.
cellSelectionbooleantrueEnable cell range selection (needed for status bar aggregations).