Text cell type
Use the text cell type, the default cell type in Handsontable, to display and edit plain text values.
Overview
The text cell type is the default cell type in Handsontable. It renders a cell’s value as plain text and lets you edit it with a standard text input. It has no built-in validator.
Because text is the default, you don’t need to set type: 'text' for it to apply. Set it explicitly when you want to override a different type inherited from a higher configuration level, or when you want the configuration to state the type directly, for example to guard alphanumeric codes or values with leading zeros against being reformatted by another type.
/* file: app.component.ts */import { Component } from '@angular/core';import { GridSettings, HotTableModule} from '@handsontable/angular-wrapper';
@Component({ selector: 'example1-text-cell-type', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent {
readonly data = [ { sku: '004821', category: '032', quantity: 142, unitPrice: 18.5 }, { sku: '000093', category: '032', quantity: 0, unitPrice: 42.0 }, { sku: '017640', category: '015', quantity: 67, unitPrice: 9.99 }, { sku: '002210', category: '015', quantity: 310, unitPrice: 4.25 }, { sku: '008875', category: '048', quantity: 24, unitPrice: 129.0 }, ];
readonly gridSettings: GridSettings = { colHeaders: ['SKU', 'Category code', 'Quantity', 'Unit price ($)'], height: 'auto', autoWrapRow: true, autoWrapCol: true, columns: [ { data: 'sku', type: 'text' }, { data: 'category', type: 'text' }, { data: 'quantity', type: 'numeric' }, { data: 'unitPrice', type: 'numeric' }, ] };}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig, NON_COMMERCIAL_LICENSE } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { license: NON_COMMERCIAL_LICENSE } as HotGlobalConfig, }, ],};/* end-file */<div> <example1-text-cell-type></example1-text-cell-type></div>In the example above, the sku and category columns use type: 'text' explicitly, even though it’s the default. This makes the configuration self-documenting: values such as '004821' are alphanumeric codes with leading zeros, not numbers, and the explicit type states that intent even if a later change sets a different type at the grid or column level.
Adding a validator
The text cell type ships without a built-in validator. To validate text values, combine type: 'text' with your own validator function, and set allowInvalid to false to reject invalid entries.
With allowInvalid: false, the cell editor doesn’t close on an invalid value. It stays open until you either enter a value that passes validation or press Esc to cancel the edit and restore the previous value. See invalid cell commit semantics for the full behavior, including how it differs from allowInvalid: true.
/* file: app.component.ts */import { Component } from '@angular/core';import { GridSettings, HotTableModule} from '@handsontable/angular-wrapper';
const skuValidator = (value: unknown, callback: (isValid: boolean) => void) => { callback(/^\d{6}$/.test(String(value)));};
@Component({ selector: 'example2-text-cell-type', standalone: true, imports: [HotTableModule], template: ` <div> <hot-table [data]="data" [settings]="gridSettings"></hot-table> </div>`,})export class AppComponent {
readonly data = [ { sku: '004821', supplier: 'Harbor Goods', quantity: 142 }, { sku: '000093', supplier: 'Alpine Supply Co.', quantity: 0 }, { sku: '017640', supplier: 'Harbor Goods', quantity: 67 }, { sku: '002210', supplier: 'Crestline Wholesale', quantity: 310 }, { sku: '008875', supplier: 'Alpine Supply Co.', quantity: 24 }, ];
readonly gridSettings: GridSettings = { colHeaders: ['SKU', 'Supplier', 'Quantity'], height: 'auto', autoWrapRow: true, autoWrapCol: true, columns: [ { data: 'sku', type: 'text', validator: skuValidator, allowInvalid: false }, { data: 'supplier', type: 'text' }, { data: 'quantity', type: 'numeric' }, ] };}/* end-file */
/* file: app.config.ts */import { ApplicationConfig, provideZoneChangeDetection } from '@angular/core';import { registerAllModules } from 'handsontable/registry';import { HOT_GLOBAL_CONFIG, HotGlobalConfig, NON_COMMERCIAL_LICENSE } from '@handsontable/angular-wrapper';
// register Handsontable's modulesregisterAllModules();
export const appConfig: ApplicationConfig = { providers: [ provideZoneChangeDetection({ eventCoalescing: true }), { provide: HOT_GLOBAL_CONFIG, useValue: { license: NON_COMMERCIAL_LICENSE } as HotGlobalConfig, }, ],};/* end-file */<div> <example2-text-cell-type></example2-text-cell-type></div>Result
After configuring the text cell type, cells display and edit their value as plain text, with no formatting or masking applied. Combine it with a custom validator to restrict which values a text cell accepts.
Keyboard shortcuts
The text cell editor uses the standard edition keyboard shortcuts. It has no type-specific key bindings.
Related articles
Related guides
Configuration options
Core methods
Hooks