Skip to content

mergeTheme

Overview

Custom merge function for merging theme objects, ensuring classes are combined.

Layers merge left to right, so later arguments win. Pass a lodash-style customizer as the final argument to control how the layers combine, the way lodash mergeWith does. The returned object shares no reference with any argument, so the caller may mutate it freely.

Throws when given fewer than two layers. Nothing merges in that case, so the call is a mistake rather than a degenerate result: it reads as a merge while returning one layer. To merge a variable number of layers, seed the call with an empty object, as buildForm does: mergeTheme({}, ...layers).

Signature

mergeTheme(themes)

Parameters

NameTypeRequiredDescription
themesFunction | ThemeObject[]yesTwo or more ThemeObjects to merge, optionally followed by a merge customizer.

Returns

ThemeObject

  • The merged ThemeObject.

Throws

  • When fewer than two theme layers are supplied.

Source

client/lib/use/themeRegistry.js:99

Documents matching: server v3.0.0a1.post1client v3.0.0-alpha.2