AutoLink
Options
autoLink
Can be set at: grid columns cells cell
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:
| Setting | Description |
|---|---|
false (default) | Disable the AutoLink plugin |
true | Enable the AutoLink plugin with the default settings |
| An object | Enable the AutoLink plugin and configure its settings |
If you set the autoLink option to an object, you can configure the following settings:
| Option | Possible settings | Description |
|---|---|---|
target | '_blank' (default) | '_self' | Where the links open |
schemes | An 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. |
inline | true (default) | false | true: link URLs inside longer textfalse: link only a cell whose whole value is one URL |
strict | true (default) | false | true: link only URLs that carry a schemefalse: 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 |
className | A 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 valuesautoLink: true,
// open links in the same tab, link web URLs only, and add a class to every linkautoLink: { 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 textautoLink: true,columns: [ { data: 'website' }, { data: 'notes', autoLink: false },],Members
DEFAULT_SETTINGS
AutoLink.DEFAULT_SETTINGS
Returns the default settings applied when the plugin is enabled without explicit configuration.
PLUGIN_KEY
AutoLink.PLUGIN_KEY
Returns the plugin key used to identify this plugin in Handsontable settings.
PLUGIN_PRIORITY
AutoLink.PLUGIN_PRIORITY
Returns the priority order used to determine the order in which plugins are initialized.
SETTINGS_VALIDATORS
AutoLink.SETTINGS_VALIDATORS
Returns an object of validator functions used to type-check each settings property at runtime.
Methods
destroy
autoLink.destroy()
Destroys the plugin instance.
disablePlugin
autoLink.disablePlugin()
Disables the plugin functionality for this Handsontable instance.
enablePlugin
autoLink.enablePlugin()
Enables the plugin functionality for this Handsontable instance.
isEnabled
autoLink.isEnabled() ⇒ boolean
Checks if the plugin is enabled in the Handsontable settings.
updatePlugin
autoLink.updatePlugin()
Updates the plugin’s state. This method is executed when updateSettings() is invoked with any
of the plugin’s settings.