You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/guides/guides-getting-started.md
+1-2Lines changed: 1 addition & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@ The following steps will create a React app that uses Instructure UI. Recommende
15
15
---
16
16
type: code
17
17
---
18
-
19
18
npm create vite@latest my-cool-app
20
19
```
21
20
@@ -63,7 +62,7 @@ export default App
63
62
64
63
What does this code do?
65
64
66
-
-[InstUISettingsProvider](InstUISettingsProvider) allows to specify the text direction (default is the direction that the user's browser supplies) and the theme to your application. InstUI components require a theme to work, all components are themeable, and themes control their look and feel. There are 2 built-in themes: [`canvas`](canvas)and [`canvasHighContrast`](canvas-high-contrast). The component examples seen throughout the documentation use the [canvas theme](canvas) by default.
65
+
-[InstUISettingsProvider](InstUISettingsProvider) allows to specify the text direction (default is the direction that the user's browser supplies) and the theme to your application. InstUI components require a theme to work, all components are themeable, and themes control their look and feel. Starting from v11.7 there are 4 built-in themes: [`canvas`](canvas), [`canvas-high-contrast`](canvas-high-contrast), [`light`](light)and [`dark`](dark). For v11.6 components the legacy themes [`legacy-canvas`](legacy-canvas) and [`legacy-canvas-high-contrast`](legacy-canvas-high-contrast) are available. The component examples seen throughout the documentation use the [canvas theme](canvas) by default.
67
66
-[Button](Button) is an Instructure UI button component
68
67
69
68
Finally, run `pnpm run dev` to start up a basic development server.
Copy file name to clipboardExpand all lines: docs/theming/new-theme-overrides.md
+6-52Lines changed: 6 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -527,9 +527,9 @@ type: example
527
527
</InstUISettingsProvider>
528
528
```
529
529
530
-
### 13. Targeted override for a parent component
530
+
### 13. Provider-level overrides cannot target a child component selectively
531
531
532
-
You can use the parent component's name (e.g. `Button`) in `themeOverride.components` to override its internal child component's tokens. When both `BaseButton` and `Button`overrides are present, the `Button` override should take precedence for `Button` instances, while `BaseButton` stays unaffected.
532
+
Because `Button` uses `BaseButton`'s theme internally, a `components.Button` entry in the provider's `themeOverride` does **not**override `BaseButton`'s tokens for `Button` instances only. Both `BaseButton` and `Button`share the same `BaseButton` theme variables, so a `components.BaseButton` override affects both, regardless of whether a separate `components.Button` entry is also present.
533
533
534
534
```js
535
535
---
@@ -551,15 +551,17 @@ type: example
551
551
}}
552
552
>
553
553
<BaseButton color="primary" margin="small">
554
-
BaseButton -still purple (BaseButton override)
554
+
BaseButton -purple (BaseButton override)
555
555
</BaseButton>
556
556
<Button color="primary" margin="small">
557
-
Button -deeppink(Button override wins)
557
+
Button -also purple(Button uses BaseButton's theme; deeppink has no effect)
558
558
</Button>
559
559
</InstUISettingsProvider>
560
560
</InstUISettingsProvider>
561
561
```
562
562
563
+
To override a specific `Button` instance without affecting others, use the per-component `themeOverride` prop instead (see section 14).
When a provider sets `components.BaseButton` overrides, a specific `Button` instance can override those via its own `themeOverride` prop. The per-component prop has the highest priority.
@@ -599,54 +601,6 @@ type: example
599
601
</InstUISettingsProvider>
600
602
```
601
603
602
-
### 15. Overrides on functional (`useStyleNew`) components
603
-
604
-
All override patterns work identically on functional components that use the `useStyleNew` hook. Here, Avatar tokens are overridden the same way as class-based components using `withStyleNew`.
605
-
606
-
```js
607
-
---
608
-
type: example
609
-
---
610
-
<InstUISettingsProvider theme={light}>
611
-
<Avatar name="Default" color="accent1" margin="0 small 0 0"/>
612
-
613
-
<InstUISettingsProvider
614
-
themeOverride={{
615
-
components: {
616
-
Avatar: {
617
-
backgroundColor:'navy',
618
-
blueTextColor:'lime'
619
-
}
620
-
}
621
-
}}
622
-
>
623
-
<Avatar name="Overridden" color="accent1" margin="0 small 0 0"/>
624
-
<Avatar name="Unaffected" color="accent2"/>
625
-
</InstUISettingsProvider>
626
-
</InstUISettingsProvider>
627
-
```
628
-
629
-
### 16. Function form `themeOverride` on functional components
630
-
631
-
The function form also works on `useStyleNew` components. The function receives the component's calculated theme as the first argument, letting you derive overrides from existing token values.
632
-
633
-
```js
634
-
---
635
-
type: example
636
-
---
637
-
<InstUISettingsProvider theme={light}>
638
-
<Avatar name="Default Blue" color="accent1" margin="0 small 0 0"/>
0 commit comments