Skip to main content

addClassNamesToElement

function

Takes an HTML element and adds the classNames passed within an array, ignoring any non-string types. A space can be used to add multiple classes eg. addClassNamesToElement(element, ['element-inner active', true, null]) will add both 'element-inner' and 'active' as classes to that element.

function addClassNamesToElement(element: HTMLElement, ...classNames: (typeof undefined | boolean | null | string)[]): void

Import

import { addClassNamesToElement } from '@modular/sdk/editor';