Skip to main content

Function: useCssClasses()

useCssClasses(): (classRules, component?) => string

Defined in: packages/react-page-renderer/src/hooks/cssClasses.ts:14

Provides direct access to CssClasses.

Returns​

CssClasses function.

(classRules, component?): string

Generate a string of CSS classes from the properties of the passed-in object that resolve to true.

Parameters​

classRules​

Argument

CSS classes in a string separated by whitespace, or a map of CSS class names to boolean values. The CSS class name will be included in the result only if the value is true.

component?​

The component requiring the composition of the CSS class names, if it has the className property set and requires its inclusion this time.

string | ComponentType

Returns​

string

String of CSS classes that had their property resolved to true.

Example​

const cssClasses = useCssClasses();