A theme provider component that uses Lit context to provide theme information to descendant components.
This component allows you to scope a theme to a specific part of the page. All library components within this provider will use the specified theme instead of the global theme.
- Element
-
igc-theme-provider
- Slots
-
default— Default slot for content that should receive the provided theme.
Remarks
Example
<!-- Scope material theme to a section -->
<igc-theme-provider theme="material" variant="dark">
<igc-button>Material Dark Button</igc-button>
<igc-input label="Material Dark Input"></igc-input>
</igc-theme-provider>
<!-- Use different theme in another section -->
<igc-theme-provider theme="fluent" variant="light">
<igc-button>Fluent Light Button</igc-button>
</igc-theme-provider> Properties
Section titled "Properties"theme
Section titled "theme"The theme to provide to descendant components.
theme: Theme = 'bootstrap' Defined in src/components/theme-provider/theme-provider.ts:77
variant
Section titled "variant"The theme variant to provide to descendant components.
variant: ThemeVariant = 'light' Defined in src/components/theme-provider/theme-provider.ts:86
styles
Section titled "styles"Array of styles to apply to the element. The styles should be defined using the css tag function, via constructible stylesheets, or imported from native CSS module scripts.
Note on Content Security Policy:
Element styles are implemented with <style> tags when the browser doesn't
support adopted StyleSheets. To use such <style> tags with the style-src
CSP directive, the style-src value must either include 'unsafe-inline' or
nonce-<base64-value> with <base64-value> replaced be a server-generated
nonce.
To provide a nonce to use on generated <style> elements, set
window.litNonce to a server-generated nonce in your page's HTML, before
loading application code:
``
styles: CSSResult Defined in src/components/theme-provider/theme-provider.ts:49