Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
jzempel committed Dec 20, 2024
1 parent a13a1e0 commit 4d55e11
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion packages/theming/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,37 @@ complex, depending on your needs:
behavior and RTL layout of Garden's tabs component with an alternate visual
design (i.e. closer to the look of browser tabs).

### RTL
#### Color scheme

The `ColorSchemeProvider` and `useColorScheme` hook add the capability for a
user to persist a preferred system color scheme (`'light'`, `'dark'`, or
`'system'`). See
[Storybook](https://zendeskgarden.github.io/react-components/?path=/docs/packages-theming-colorschemeprovider--color-scheme-provider)
for more details.

```jsx
import {
useColorScheme,
ColorSchemeProvider,
ThemeProvider,
DEFAULT_THEME
} from '@zendeskgarden/react-theming';

const ThemedApp = ({ children }) => {
const { colorScheme } = useColorScheme();
const theme = { ...DEFAULT_THEME, colors: { ...DEFAULT_THEME.colors, base: colorScheme } };

return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
};

const App = ({ children }) => (
<ColorSchemeProvider>
<ThemedApp>{children}</ThemedApp>
</ColorSchemeProvider>
);
```

#### RTL

```jsx
import { ThemeProvider, DEFAULT_THEME } from '@zendeskgarden/react-theming';
Expand Down

0 comments on commit 4d55e11

Please sign in to comment.