Skip to content

AutoLink

Options

Can be set at: grid columns cells cell

Source code

autoLink.autoLink : boolean | object

The autoLink option configures the AutoLink plugin, which renders the URLs found in cell values as clickable links.

You can set the autoLink option to one of the following:

SettingDescription
false (default)Disable the AutoLink plugin
trueEnable the AutoLink plugin with the default settings
An objectEnable the AutoLink plugin and configure its settings

If you set the autoLink option to an object, you can configure the following settings:

OptionPossible settingsDescription
target'_blank' (default) | '_self'Where the links open
schemesAn array of 'http', 'https', 'mailto', 'tel' (default: all four)The URL schemes to link. Narrows the fixed four-scheme allowlist, never widens it. A column or cell schemes replaces the grid-level list for those cells.
inlinetrue (default) | falsetrue: link URLs inside longer text
false: link only a cell whose whole value is one URL
stricttrue (default) | falsetrue: link only URLs that carry a scheme
false: also link bare domains (example.com) as https and bare email addresses as mailto, validated against the IANA top-level domain list bundled with Handsontable
classNameA string (default: '')Extra class name(s) added to every link

The full IANA top-level domain list is used, so a file name whose extension is also a top-level domain, such as report.zip or README.md, links too. Keep the default unless your data holds bare domains or email addresses, and keep strict: true or set autoLink: false on columns that hold file names. The bundled list is fixed at build time - Handsontable makes no network request to validate a bare domain, which keeps strict: false usable in an air-gapped environment. Punycode top-level domains (xn--...) are skipped, since nobody types those into a cell.

The cell keeps its own renderer and its value stays unchanged, so copying, autofill, sorting, and export are unaffected. Every link element gets the ht-link and ht-auto-link classes, and always carries rel="noopener noreferrer". Press Alt+Enter to open the first link of the selected cell.

For mailto: and tel: links, the scheme prefix is wrapped in a ht-link-scheme element and hidden, so the cell shows only the address or the number. The cell value and the link target keep the prefix.

Only the http, https, mailto, and tel schemes are ever linked. A cell that already contains a link element, such as a HYPERLINK cell rendered through formulas.hyperlinks or an html cell holding an anchor, is left as it is.

The plugin is enabled at the grid level. Set autoLink: false for a column or a cell to opt it out, or set an object to override the grid-level settings for that column or cell.

Read more:

Default: false
Since: 19.0.0
Example

// link every URL, email address and phone number found in cell values
autoLink: true,
// open links in the same tab, link web URLs only, and add a class to every link
autoLink: {
target: '_self',
schemes: ['http', 'https'],
className: 'company-link',
},
// also link bare domains (as `https`) and bare email addresses (as `mailto`)
autoLink: {
strict: false,
},
// enable the plugin, but keep one column as plain text
autoLink: true,
columns: [
{ data: 'website' },
{ data: 'notes', autoLink: false },
],

Members

DEFAULT_SETTINGS

Source code

AutoLink.DEFAULT_SETTINGS

Returns the default settings applied when the plugin is enabled without explicit configuration.

PLUGIN_KEY

Source code

AutoLink.PLUGIN_KEY

Returns the plugin key used to identify this plugin in Handsontable settings.

PLUGIN_PRIORITY

Source code

AutoLink.PLUGIN_PRIORITY

Returns the priority order used to determine the order in which plugins are initialized.

SETTINGS_VALIDATORS

Source code

AutoLink.SETTINGS_VALIDATORS

Returns an object of validator functions used to type-check each settings property at runtime.

Methods

destroy

Source code

autoLink.destroy()

Destroys the plugin instance.

disablePlugin

Source code

autoLink.disablePlugin()

Disables the plugin functionality for this Handsontable instance.

enablePlugin

Source code

autoLink.enablePlugin()

Enables the plugin functionality for this Handsontable instance.

isEnabled

Source code

autoLink.isEnabled() ⇒ boolean

Checks if the plugin is enabled in the Handsontable settings.

updatePlugin

Source code

autoLink.updatePlugin()

Updates the plugin’s state. This method is executed when updateSettings() is invoked with any of the plugin’s settings.