Skip to content

Commit 6b00bb1

Browse files
committed
check edits
1 parent e1c1927 commit 6b00bb1

File tree

3 files changed

+66
-57
lines changed

3 files changed

+66
-57
lines changed

powerapps-docs/developer/component-framework/fluent-modern-theming.md

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: You can style your components based on the modern theme used in the
44
keywords: "Component Framework, code components, Power Apps controls"
55
ms.author: hemantg
66
author: HemantGaur
7-
ms.date: 10/06/2023
7+
ms.date: 11/15/2023
88
ms.reviewer: jdaly
99
ms.custom:
1010
- "dyn365-a11y"
@@ -21,18 +21,17 @@ contributors:
2121

2222
[!INCLUDE [cc-beta-prerelease-disclaimer](../../includes/cc-beta-prerelease-disclaimer.md)]
2323

24-
Professional developers need to be able to style their components so they look like the rest of the application they are included in. This is particularly true when modern theming is in effect for either a canvas app (via the [Modern controls and themes](../../maker/canvas-apps/controls/modern-controls/overview-modern-controls.md) feature) or model app (through the [new refreshed look](../../user/modern-fluent-design.md)). Utilizing modern theming, which is based on [Fluent UI React v9](https://react.fluentui.dev/), to style your component is the recommended way to get the best performance and theming experience for your component.
24+
Developers need to be able to style their components so they look like the rest of the application they're included in. They can do this when modern theming is in effect for either a canvas app (via the [Modern controls and themes](../../maker/canvas-apps/controls/modern-controls/overview-modern-controls.md) feature) or model-driven app (through the [new refreshed look](../../user/modern-fluent-design.md)). Use modern theming, which is based on [Fluent UI React v9](https://react.fluentui.dev/), to style your component. This approach is recommended to get the best performance and theming experience for your component.
2525

26-
In this article, we will describe 4 different ways to apply modern theming to your component.
26+
There are four different ways to apply modern theming to your component.
2727

2828
- Fluent v9 controls
2929
- Fluent v8 controls
3030
- Non-Fluent controls
3131
- Custom theme providers
3232

33-
## Fluent UI v9 controls
3433

35-
Wrapping Fluent UI v9 controls as a component is the easiest way to utilize modern theming as the modern theme will be automatically applied to these controls. The only prerequisite is to ensure your component adds a dependency on the [React controls & platform libraries (Preview)](../../component-framework/react-controls-platform-libraries.md) as shown below. This allows your component to use the same React and Fluent libraries as the platform and therefore share the same React context through which the theme tokens are passed down to the component.
34+
Wrapping Fluent UI v9 controls as a component is the easiest way to utilize modern theming because the modern theme is automatically applied to these controls. The only prerequisite is to ensure your component adds a dependency on the [React controls & platform libraries (Preview)](../../component-framework/react-controls-platform-libraries.md) as shown below. This approach allows your component to use the same React and Fluent libraries as the platform, and therefore share the same React context that passes the theme tokens down to the component.
3635

3736
```xml
3837
<resources>
@@ -45,7 +44,7 @@ Wrapping Fluent UI v9 controls as a component is the easiest way to utilize mode
4544

4645
## Fluent UI v8 controls
4746

48-
When using Fluent UI v8 controls in your component, Fluent provides a migration path for applying v9 theme constructs. In particular, you can create a v8 theme based on v9 theme tokens using the `createV8Theme` function included in the [Fluent's v8 to v9 migration package](https://www.npmjs.com/package/@fluentui/react-migration-v8-v9) using the code pattern below.
47+
Fluent provides a migration path for applying v9 theme constructs when you use Fluent UI v8 controls in your component. Use the `createV8Theme` function included in the [Fluent's v8 to v9 migration package](https://www.npmjs.com/package/@fluentui/react-migration-v8-v9) to create a v8 theme based on v9 theme tokens, as shown in the following example:
4948

5049
```tsx
5150
const theme = createV8Theme(
@@ -57,7 +56,7 @@ return <ThemeProvider theme={theme}></ThemeProvider>;
5756

5857
### Non-Fluent UI controls
5958

60-
Components that are not using Fluent UI can take a dependency directly on the v9 theme tokens available through the `fluentDesignLanguage` context parameter. This parameter provides access to all [theme](../reference/theming.md) tokens, allowing a component to reference any aspect of the theme to style itself.
59+
If your component doesn't use Fluent UI, you can take a dependency directly on the v9 theme tokens available through the `fluentDesignLanguage` context parameter. Use this parameter to get access to all [theme](reference/theming.md) tokens so it can reference any aspect of the theme to style itself.
6160

6261
```tsx
6362
<span style={{ fontSize: context.fluentDesignLanguage.theme.fontSizeBase300 }}>
@@ -67,7 +66,7 @@ Components that are not using Fluent UI can take a dependency directly on the v9
6766

6867
## Custom theme providers
6968

70-
For components that require styling that is partially or completely different from the current theme of the app, developers can create your own `FluentProvider` and pass your own set of theme tokens to be uptaken by your component.
69+
When your component requires styling that is different from the current theme of the app, create your own `FluentProvider` and pass your own set of theme tokens to be used by your component.
7170

7271
```tsx
7372
<FluentProvider theme={context.fluentDesignLanguage.tokenTheme}>
@@ -81,38 +80,40 @@ Examples for each of these use cases are available at [Modern Theming API contro
8180

8281
## FAQ
8382

84-
### Q: My control uses Fluent UI v9 and has a dependency on the platform libraries, but I do not want to utilize modern theming. How can I disable it for my component?
83+
This section contains frequently asked questions. If you have a question about this feature, use the **Feedback** for **This page** button at the bottom of this page to create a GitHub issue.
8584

86-
A: There are two ways to accomplish this:
85+
### Q: My control uses Fluent UI v9 and has a dependency on the platform libraries, but I don't want to utilize modern theming. How can I disable it for my component?
86+
87+
**A**: You can do this two different ways:
8788

8889
1. You can create your own component-level `FluentProvider`
8990

90-
```tsx
91-
<FluentProvider theme={customFluentV9Theme}>
92-
{/* your control */}
93-
</FluentProvider>
94-
```
91+
```tsx
92+
<FluentProvider theme={customFluentV9Theme}>
93+
{/* your control */}
94+
</FluentProvider>
95+
```
9596

96-
2. You can wrap your control inside `IdPrefixContext.Provider` and set your own `idPrefix` value. This will prevent your component from getting theme tokens from the platform.
97+
1. You can wrap your control inside `IdPrefixContext.Provider` and set your own `idPrefix` value. This prevents your component from getting theme tokens from the platform.
9798

98-
```tsx
99-
<IdPrefixProvider value="custom-control-prefix">
100-
<Label weight="semibold">This label is not getting Modern Theming</Label>
101-
</IdPrefixProvider>
102-
```
99+
```tsx
100+
<IdPrefixProvider value="custom-control-prefix">
101+
<Label weight="semibold">This label is not getting Modern Theming</Label>
102+
</IdPrefixProvider>
103+
```
103104

104-
### Q: Some of my Fluent UI v9 controls are not getting styles
105+
### Q: Some of my Fluent UI v9 controls aren't getting styles
105106

106-
A: Fluent v9 controls that rely on the React Portal will need to be rewrapped in the theme provider to ensure styling is properly applied. You can use `FluentProvider`.
107+
**A**: Fluent v9 controls that rely on the React Portal need to be rewrapped in the theme provider to ensure styling is properly applied. You can use `FluentProvider`.
107108

108109
### Q: How can I check if modern theming is enabled
109110

110-
A: You can check if tokens are available: `context.fluentDesignLanguage?.tokenTheme`. Or in model-driven applications you can check app settings: `context.appSettings.getIsFluentThemingEnabled()`.
111+
**A**: You can check if tokens are available: `context.fluentDesignLanguage?.tokenTheme`. Or in model-driven applications you can check app settings: `context.appSettings.getIsFluentThemingEnabled()`.
111112

112-
## Related topics
113+
## Related articles
113114

114-
[Theming (Power Apps component framework API reference)](../component-framework/reference/theming.md)<br />
115-
[Modern Theming API control](./sample-controls/modern-theming-api-control.md)
116-
[Use modern themes in canvas apps (preview)](../../../maker/canvas-apps/controls/modern-controls/modern-theming)
115+
[Theming (Power Apps component framework API reference)](../component-framework/reference/theming.md)
116+
[Modern Theming API control](./sample-controls/modern-theming-api-control.md)
117+
[Use modern themes in canvas apps (preview)](../../maker/canvas-apps/controls/modern-controls/modern-theming.md)
117118

118119
[!INCLUDE[footer-include](../../includes/footer-banner.md)]

powerapps-docs/developer/component-framework/reference/theming.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: Theming (Power Apps component framework API reference) | Microsoft Docs
3-
description: Provides API for the platform provided Modern Theme.
4-
ms.author: noazarur
5-
author: noazarur-microsoft
6-
ms.date: 10/04/2023
3+
description: Provides the API for platform-provided modern theming.
4+
ms.author: lesyk
5+
author: vilesyk
6+
ms.date: 11/15/2023
77
ms.reviewer: jdaly
88
ms.topic: reference
99
ms.subservice: pcf
@@ -29,19 +29,19 @@ Model-driven and canvas apps
2929

3030
Fluent v9 theme tokens provided by the platform.
3131

32-
**Type**: [Theme](https://github.com/microsoft/fluentui/blob/401ff6d9af9536b24ab3c52c658127d19706e030/packages/tokens/src/types.ts)
32+
**Type**: [Theme](https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/types.ts)
3333

3434
### typographyTokens
3535

3636
Fluent v9 typography tokens provided by the platform.
3737

38-
**Type**: [TypographyStyles](https://github.com/microsoft/fluentui/blob/401ff6d9af9536b24ab3c52c658127d19706e030/packages/tokens/src/global/typographyStyles.ts)
38+
**Type**: [TypographyStyles](https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/global/typographyStyles.ts)
3939

4040
### brand
4141

4242
Fluent v9 BrandVariants based on which Fluent v9 theme was generated.
4343

44-
**Type**: [BrandVariants](https://github.com/microsoft/fluentui/blob/401ff6d9af9536b24ab3c52c658127d19706e030/packages/tokens/src/types.ts)
44+
**Type**: [BrandVariants](https://github.com/microsoft/fluentui/blob/master/packages/tokens/src/types.ts)
4545

4646
### isDarkTheme
4747

@@ -51,7 +51,7 @@ Indicates whether the current theme is dark or not.
5151

5252
## Example
5353

54-
```TSX
54+
```tsx
5555
const fluentDesignLanguage = props.context.fluentDesignLanguage;
5656

5757
return (
@@ -68,8 +68,8 @@ return (
6868

6969
### Related articles
7070

71-
[Use modern themes in canvas apps (preview)](../../../maker/canvas-apps/controls/modern-controls/modern-theming)
72-
[Power Apps component framework API reference](../reference/index.md)<br />
71+
[Use modern themes in canvas apps (preview)](../../../maker/canvas-apps/controls/modern-controls/modern-theming)
72+
[Power Apps component framework API reference](../reference/index.md)
7373
[Power Apps component framework overview](../overview.md)
7474

7575
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]
Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Modern theming API component | Microsoft Docs"
3-
description: "This sample component demonstrates various ways of utiliznig the modern theming API capabilities to style your component."
3+
description: "This sample component demonstrates various ways to use the modern theming API capabilities to style your component."
44
author: lesyk
55
ms.author: vilesyk
66
ms.date: 03/12/2023
@@ -15,35 +15,43 @@ contributors:
1515

1616
# Implementing a modern theming API component
1717

18-
This sample component showcases a variety of use cases for utilizing the modern theming API capabilities to style your component based on the current theme used in your app. The imported components will adhere to the default Power Apps modern theme initially, until the you have [enabled modern controls and themes for your app](../../../powerapps/maker/canvas-apps/controls/modern-controls/overview-modern-controls.md#enable-modern-controls-and-themes-for-your-app) and [applied a modern theme](../../../maker/canvas-apps/controls/modern-controls/modern-theming#apply-modern-theme).
18+
This sample component shows use cases to use the modern theming API capabilities to style your component based on the current theme used in your app. The imported components adhere to the default Power Apps modern theme initially, until you [enable modern controls and themes for your app](../../../powerapps/maker/canvas-apps/controls/modern-controls/overview-modern-controls.md#enable-modern-controls-and-themes-for-your-app) and [apply a modern theme](../../../maker/canvas-apps/controls/modern-controls/modern-theming#apply-modern-theme).
1919

20-
> [!div class="mx-imgBorder"] > ![Modern Theming API component](../media/modern-theming-api-control-blue.png "Modern Theming API component blue theme")
21-
> [!div class="mx-imgBorder"] > ![Modern Theming API component](../media/modern-theming-api-control-red.png "Modern Theming API component red theme")
22-
> [!div class="mx-imgBorder"] > ![Modern Theming API component](../media/modern-theming-api-control-green.png "Modern Theming API component gree theme")
20+
:::row:::
21+
:::column:::
22+
:::image type="content" source="../media/modern-theming-api-control-blue.png" alt-text="Modern Theming API component blue theme":::
23+
:::column-end:::
24+
:::column:::
25+
:::image type="content" source="../media/modern-theming-api-control-red.png" alt-text="Modern Theming API component red theme":::
26+
:::column-end:::
27+
:::column:::
28+
:::image type="content" source="../media/modern-theming-api-control-green.png" alt-text="Modern Theming API component green theme":::
29+
:::column-end:::
30+
:::row-end:::
2331

2432
## Available for
2533

2634
Model-driven and canvas apps
2735

2836
## Code
2937

30-
The sample component illustrates four different examples consuming the Power Apps modern theming API.
38+
The sample component demonstrates four different examples consuming the Power Apps modern theming API.
3139

32-
- Fluent v9 sample with automatic application of the current modern theme: [Automatic Modern Theming](../../component-framework/fluent-modern-theming.md#automatic-modern-theming)<br/>
33-
- Fluent v8 sample styling itself by creating its own v8 ThemeProvider based on the v9 theme tokens passed via the PCF context parameters: [Modern Theming for Fluent UI v8 controls](../../component-framework/fluent-modern-theming.md#modern-theming-for-fluent-ui-v8-controls)<br/>
34-
- Non-Fluent sample that applies styling to its HTML elements by directly referencing v9 theme tokens passed via the PCF context parameters: [Modern Theming for non-Fluent UI controls](../../component-framework/fluent-modern-theming.md#modern-theming-for-non-fluent-ui-controls)<br/>
35-
- Fluent v9 sample creating its own custom v9 FluentProvider modifying the theme passed via the PCF context parameters. [Modern Theming via PCF context parameters](../../component-framework/fluent-modern-theming.md#modern-theming-via-pcf-context-parameters)<br/>
40+
- Fluent v9 sample with automatic application of the current modern theme: [Automatic Modern Theming](../../component-framework/fluent-modern-theming.md#automatic-modern-theming)
41+
- Fluent v8 sample styling itself by creating its own v8 ThemeProvider based on the v9 theme tokens passed via the PCF context parameters: [Modern Theming for Fluent UI v8 controls](../../component-framework/fluent-modern-theming.md#modern-theming-for-fluent-ui-v8-controls)
42+
- Non-Fluent sample that applies styling to its HTML elements by directly referencing v9 theme tokens passed via the PCF context parameters: [Modern Theming for non-Fluent UI controls](../../component-framework/fluent-modern-theming.md#modern-theming-for-non-fluent-ui-controls)
43+
- Fluent v9 sample creating its own custom v9 FluentProvider modifying the theme passed via the PCF context parameters. [Modern Theming via PCF context parameters](../../component-framework/fluent-modern-theming.md#modern-theming-via-pcf-context-parameters)
3644

37-
You can download the complete sample component from [here](https://github.com/microsoft/PowerApps-Samples/tree/master/component-framework/FluentThemingAPIControl).
45+
You can download the sample component from [PowerApps-Samples/component-framework/FluentThemingAPIControl](https://github.com/microsoft/PowerApps-Samples/tree/master/component-framework/FluentThemingAPIControl).
3846

39-
### Related topics
47+
### Related articles
4048

41-
[Download sample components](https://github.com/microsoft/PowerApps-Samples/tree/master/component-framework)<br/>
42-
[How to use the sample components](../use-sample-components.md)<br/>
43-
[Power Apps component framework API reference](../reference/index.md)<br/>
44-
[Style components with modern theming (Preview)](../../component-framework/fluent-modern-theming.md)<br/>
45-
[Theming (Power Apps component framework API reference) | Microsoft Docs](../../../powerapps/developer/component-framework/reference/theming)
46-
[Use modern themes in canvas apps (preview)](../../../maker/canvas-apps/controls/modern-controls/modern-theming)
47-
[Overview of mdoern controls and themes (preview)](../../..//maker/canvas-apps/controls/modern-controls/overview-modern-controls)
49+
[Download sample components](https://github.com/microsoft/PowerApps-Samples/blob/master/component-framework/README.md)
50+
[How to use the sample components](../use-sample-components.md)
51+
[Power Apps component framework API reference](../reference/index.md)
52+
[Style components with modern theming (Preview)](../../component-framework/fluent-modern-theming.md)
53+
[Theming reference](../../../powerapps/developer/component-framework/reference/theming)
54+
[Use modern themes in canvas apps (preview)](../../../maker/canvas-apps/controls/modern-controls/modern-theming)
55+
[Overview of modern controls and themes (preview)](../../..//maker/canvas-apps/controls/modern-controls/overview-modern-controls)
4856

4957
[!INCLUDE[footer-include](../../../includes/footer-banner.md)]

0 commit comments

Comments
 (0)