UtilAdded in v14.11Updated in v16Optional

wrToClassList

Flattens class inputs into a de-duplicated list of single class names.

Usage

Pass your own CDK panelClass through it: the CDK does not split 'a b' and throws.

import { wrToClassList } from 'ngwr/utils';

wrToClassList('p-4 rounded-xl');            // ['p-4', 'rounded-xl']
wrToClassList(['btn', 'p-4 rounded'], 'x'); // ['btn', 'p-4', 'rounded', 'x']
wrToClassList('a', null, false, '  ', 'a'); // ['a']

API

NameDescriptionTypeDefault
wrToClassListSplits on whitespace and de-duplicates. Skips false, null, undefined and empty tokens.(...values: readonly (WrClassInput | false)[]) => string[]—

See also