Read-only cells
Make specified cells read-only to protect them from unwanted changes but still allow navigation and copying of data.
Disable individual cells, entire columns, or entire rows to prevent user edits. Use readOnly on cells, columns, or the whole grid.
Overview
Disabling a cell makes the cell read-only or non-editable. Both have similar outcomes, with the following differences:
Read-only cellreadOnly: true | Non-editable celleditor: false |
|---|---|
Has an additional CSS class (htDimmed), unless you turn it off with readOnlyStyling | Has no additional CSS class |
| Copy works, paste doesn’t work | Copy-paste works |
| Drag-to-fill doesn’t work | Drag-to-fill works |
Can’t be changed by populateFromArray() | Can be changed by populateFromArray() |
| A checkbox ignores clicks, but still looks active | A checkbox is rendered as disabled |
Pick readOnly when the user must not change the value at all. Pick editor: false when you only want to take away the editor, and still accept values from pasting, drag-to-fill, or the API.
Make the grid read-only
To make the entire grid read-only, set readOnly to true as a top-level grid option.
/* file: app.component.ts */import { Component } from '@angular/core';import { GridSettings, HotTableModule } from '@handsontable/angular-wrapper';
@Component({ selector: 'example-readonly-grid', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent { readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings = { readOnly: true, height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true };}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example-readonly-grid></example-readonly-grid></div>Make a column read-only
To make a column read-only, declare it in the columns configuration option. The column remains available for keyboard navigation and copying data (Ctrl/Cmd+C), but editing and pasting are disabled. The example below also defines a custom renderer that dims the read-only column, giving the user a visual cue that its cells are read-only.
/* file: app.component.ts */import { Component } from '@angular/core';import { GridSettings, HotTableModule } from '@handsontable/angular-wrapper';import { BaseRenderer } from 'handsontable/renderers';import { textRenderer } from 'handsontable/renderers/textRenderer';
const dimmedTextRenderer: BaseRenderer = (instance, td, ...rest) => { textRenderer(instance, td, ...rest);
td.style.opacity = '0.6';};
@Component({ selector: 'example1-read-only-cells', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent {
readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings = { height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true, columns: [ { data: 'name', readOnly: true, renderer: dimmedTextRenderer, }, { data: 'symbol', }, { data: 'atomicNumber', }, { data: 'atomicMass', }, ] };}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example1-read-only-cells></example1-read-only-cells></div>Make a row read-only
To make an entire row read-only, use the cells function and set the readOnly property based on the row index, regardless of the column. The example below makes the second row (index 1) read-only.
/* file: app.component.ts */import { AfterViewInit, Component, ViewChild } from '@angular/core';import { GridSettings, HotTableComponent, HotTableModule } from '@handsontable/angular-wrapper';
@Component({ selector: 'example5-read-only-cells', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent implements AfterViewInit { @ViewChild(HotTableComponent, { static: false }) readonly hotTable!: HotTableComponent;
readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings ={ height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true };
ngAfterViewInit(): void { const hot = this.hotTable?.hotInstance;
hot?.updateSettings({ cells: (row: number) => { return row === 1 ? { readOnly: true } : {}; }, }); }}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example5-read-only-cells></example5-read-only-cells></div>Make specific cells read-only
To make specific cells read-only, use the cells function to set the readOnly property conditionally. The example below makes cells that contain the word “Helium” read-only.
/* file: app.component.ts */import { AfterViewInit, Component, ViewChild } from '@angular/core';import { GridSettings, HotTableComponent, HotTableModule } from '@handsontable/angular-wrapper';
@Component({ selector: 'example2-read-only-cells', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent implements AfterViewInit { @ViewChild(HotTableComponent, { static: false }) readonly hotTable!: HotTableComponent;
readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings ={ height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true };
ngAfterViewInit(): void { const hot = this.hotTable?.hotInstance;
hot?.updateSettings({ cells: (row: number, col: number, _: any) => { if (hot.getData()[row][col] === 'Helium') { return { readOnly: true }; }
return {}; }, }); }}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example2-read-only-cells></example2-read-only-cells></div>Non-editable cells behave like any other cells apart from preventing you from manually changing their values.
Make a column non-editable
To make a column non-editable, declare it in the columns configuration option. The column’s basic behavior does not change — you can still use keyboard navigation, Ctrl/Cmd+C, Ctrl/Cmd+V, and drag-to-fill. The example below also defines a custom renderer that dims the non-editable column, giving the user a visual cue that its cells are non-editable.
/* file: app.component.ts */import { Component } from '@angular/core';import { GridSettings, HotTableModule } from '@handsontable/angular-wrapper';import { BaseRenderer } from 'handsontable/renderers';import { textRenderer } from 'handsontable/renderers/textRenderer';
const dimmedTextRenderer: BaseRenderer = (instance, td, ...rest) => { textRenderer(instance, td, ...rest);
td.style.opacity = '0.6';};
@Component({ selector: 'example3-read-only-cells', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent {
readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings = { height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true, columns: [ { data: 'name', editor: false, renderer: dimmedTextRenderer, }, { data: 'symbol', editor: 'text', }, { data: 'atomicNumber', editor: 'numeric', }, { data: 'atomicMass', editor: 'numeric', }, ] };}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example3-read-only-cells></example3-read-only-cells></div>Make specific cells non-editable
To make specific cells non-editable, set editor: false in the cell configuration. The following example shows a table with non-editable cells containing the word “Helium”.
/* file: app.component.ts */import { AfterViewInit, Component, ViewChild } from '@angular/core';import { GridSettings, HotTableComponent, HotTableModule } from '@handsontable/angular-wrapper';
@Component({ selector: 'example4-read-only-cells', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent implements AfterViewInit { @ViewChild(HotTableComponent, { static: false }) readonly hotTable!: HotTableComponent;
readonly data = [ { name: 'Hydrogen', symbol: 'H', atomicNumber: 1, atomicMass: 1.008 }, { name: 'Helium', symbol: 'He', atomicNumber: 2, atomicMass: 4.003 }, { name: 'Lithium', symbol: 'Li', atomicNumber: 3, atomicMass: 6.94 }, { name: 'Beryllium', symbol: 'Be', atomicNumber: 4, atomicMass: 9.012 }, { name: 'Boron', symbol: 'B', atomicNumber: 5, atomicMass: 10.81 }, ];
readonly gridSettings: GridSettings = { height: 'auto', colHeaders: ['Name', 'Symbol', 'Atomic number', 'Atomic mass'], autoWrapRow: true, autoWrapCol: true };
ngAfterViewInit(): void { const hot = this.hotTable?.hotInstance;
hot?.updateSettings({ cells: (row, _col, prop) => { if (hot.getDataAtRowProp(row, prop as string) === 'Helium') { return { editor: false }; } return { editor: 'text' }; }, }); }}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { // license: 'your-license-key', // get a key at https://handsontable.com/pricing/ } as HotGlobalConfig, }, ],};/* end-file */<div> <example4-read-only-cells></example4-read-only-cells></div>Read-only cells that look editable
By default, read-only cells carry the htDimmed CSS class, which greys them out. To keep a grid read-only while it still looks like a normal table, set readOnlyStyling to false:
readOnly: true,readOnlyStyling: false,Only the appearance changes. The cells still reject edits, pasting, and drag-to-fill, and screen readers still announce them as read-only.
Like readOnly itself, you can set readOnlyStyling for the whole grid, a column, or a single cell.
To change how read-only cells look, rather than to stop styling them, set readOnlyCellClassName to a class name of your own and style that class.
Non-editable cells and cell types
A cell type sets the editor, renderer, and validator options at once. A type set on a column does not re-enable editing that you disabled higher up, so this grid is non-editable throughout, and the second column still renders and validates as numeric:
editor: false,columns: [ { type: 'text' }, { type: 'numeric' }]To let one column opt back in, give it an editor of its own, at the same configuration level as its type:
editor: false,columns: [ { type: 'text' }, // editable, despite the grid-level `editor: false` { type: 'numeric', editor: 'numeric' }]To keep the editor that the column’s type provides, without naming it, set editor: true, for example { type: 'numeric', editor: true }.
A custom cell type that declares editor: false supplies a default, not a setting of yours. If you set such a type on the whole grid, a column with a type of its own still gets that type’s editor.
If you switch editing off at runtime, pass columns in the same updateSettings() call. A column’s type writes its editor onto that column when the column is built, so editor: false passed without columns doesn’t reach a typed column:
// the numeric column stays editablehot.updateSettings({ editor: false });
// the numeric column becomes non-editable toohot.updateSettings({ editor: false, columns: [{ type: 'text' }, { type: 'numeric' }] });A checkbox has no separate editing gesture — clicking the box is the edit — so a checkbox cell with no editor is rendered as a disabled checkbox. Neither a click nor the Space key toggles it. You can still select the cell.
Toggle read-only from the menus
The Read only item of the context menu and the column menu toggles the readOnly state of the selected cells.
The cells function runs again on top of every stored cell value, so a readOnly value that it sets, by returning it or by assigning it to this, always takes precedence over the menu. When the selection also holds other cells, the Read only item skips the ones that cells controls. It changes the rest, and its check mark reflects only them.
If cells sets readOnly on every selected cell, the item behaves as it always did: it stays in the menu, shows the cell state, and can’t change anything. This is the case when cells returns a readOnly value for every cell, for example { readOnly: false } as a default.
Undo and redo of a menu toggle change only the cells that the toggle changed. A cell that the Read only item skips keeps its stored value.
Block the entire grid
The readOnly and editor options control editing, but users can still navigate and select cells. To block all interaction with the grid temporarily — for example, during a loading state or a blocking workflow step — use the Dialog plugin. An open dialog overlays the grid and moves keyboard input into its own focus scope, so users can’t reach the cells until the dialog closes. The grid regains focus automatically.
Accessibility
When ariaTags is enabled (the default), Handsontable DataGrid adds aria-readonly="true" to the DOM element of every read-only cell, so screen readers announce that the cell can’t be edited. Non-editable cells (editor: false) don’t get this attribute, because Handsontable doesn’t treat them as read-only in the data model — only their editor is disabled.
For more accessibility features and testing guidance, see Accessibility.
Result
Read-only cells display with the htDimmed CSS class — unless you set readOnlyStyling to false — and block paste and drag-to-fill operations. Non-editable cells block manual editing but allow copy-paste and drag-to-fill.
Related API reference
Configuration options