Provider

Provider component which aggregates the main Clay, Icon, and Modal.

installyarn add @clayui/core
versionNPM Version
useimport Provider from '@clayui/provider';

Example

import {Provider} from '@clayui/core';
<Provider spritemap={spritemap}>
	<Icon symbol="books" />
	<Icon symbol="times" />
</Provider>

Application provider

A Provider is a component that be at the root of your application. Provider is used by other Clay components to define theme scopes, render icons with spritemap, or help handle Modal creation in your application.

Theme

Themes in Clay is different from patterns that are common in other libraries, Clay’s CSS framework is built using Sass and we allow to create themes based on CSS scope, a class is added in Clay components that use React.Portal to render elements in the body for example.

<Provider theme="cadmin">Content</Provider>

Icon spritemap

Icons need the path where to find the icon collection to be rendered. Clay components that use the Icon component pass props from spritemap to the icon, to avoid passing spritemap to all your components at different levels, add the spritemap path in Provider to that Icon can use and avoid passing the property on all components.

<Provider spritemap={spritemap}>
	<Icon symbol="books" />
	<Icon symbol="times" />
</Provider>