import * as React from 'react'; import { Customizer as DeprecatedCustomizer } from '@fluentui/react/lib/Utilities'; import { ITheme, createTheme, DefaultPalette } from '@fluentui/react/lib/Styling'; import { FocusZone } from '@fluentui/react/lib/FocusZone'; import { CollapsibleSection, CollapsibleSectionStateless, ICollapsibleSectionComponent, ICollapsibleSectionStylesReturnType, ICollapsibleSectionTitleComponent, ICollapsibleSectionTitleStylesReturnType, } from '@fluentui/react-experiments/lib/CollapsibleSection'; // Workaround to prevent errors on usage of Customizer in this file, without disabling all deprecation checks // eslint-disable-next-line deprecation/deprecation const Customizer = DeprecatedCustomizer; const getPropStyles: ICollapsibleSectionComponent['styles'] = (props, theme): ICollapsibleSectionStylesReturnType => ({ root: [ { background: theme.semanticColors.inputBackground, }, ], body: [ theme.fonts.small, { background: theme.semanticColors.disabledBackground, }, ], }); const getCustomizerStyles: ICollapsibleSectionComponent['styles'] = ( props, theme, ): ICollapsibleSectionStylesReturnType => ({ body: [ { color: theme.semanticColors.link, }, ], }); const getPropTitleStyles: ICollapsibleSectionTitleComponent['styles'] = ( props, theme, ): ICollapsibleSectionTitleStylesReturnType => ({ text: [theme.fonts.large], }); const getCustomizerTitleStyles: ICollapsibleSectionTitleComponent['styles'] = ( props, theme, ): ICollapsibleSectionTitleStylesReturnType => ({ chevron: { color: theme.semanticColors.link }, text: { color: theme.semanticColors.link }, }); const csCustomizerTheme: ITheme = createTheme({ semanticColors: { disabledBackground: DefaultPalette.themeLight, inputBackground: DefaultPalette.themeLighter, }, }); const csPropTheme: ITheme = createTheme({ semanticColors: { disabledBackground: DefaultPalette.themeDarker, inputBackground: DefaultPalette.themeDark, }, }); export class CollapsibleSectionStyledExample extends React.Component<{}, {}> { public render(): JSX.Element { return (

This is a demonstration of the various levels of theming and styling that have effect on created components, with and without state. Themes and styles should have priority based on how locally they are defined: individual props as highest priority followed by contextual (Customizer) and finally global.

If everything is working correctly color gradients should gradually get darker within each type of component with any variant having Theme prop looking identical.

Stateful Components

Body
Body
Body
Body
Body
Body

Stateless Components

Body
Body
Body
Body
Body
Body
); } }