diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx
index abbd193c68..10d45acfe6 100644
--- a/.storybook/preview.tsx
+++ b/.storybook/preview.tsx
@@ -50,9 +50,19 @@ const preview: Preview = {
dynamicTitle: true,
},
},
+ theme: {
+ description: 'Theme for the story',
+ toolbar: {
+ title: 'Theme',
+ icon: 'circlehollow',
+ items: [{ value: 'light' }, { value: 'dark' }],
+ dynamicTitle: true,
+ },
+ },
},
initialGlobals: {
locale: 'en',
+ theme: 'light',
},
decorators: [
(Story, { parameters, globals, args, argTypes }) => {
@@ -135,6 +145,13 @@ const preview: Preview = {
);
},
+ (Story, { globals }) => {
+ const theme = (globals.theme as string) || 'light';
+ useEffect(() => {
+ document.body.setAttribute('data-color-scheme', theme);
+ }, [theme]);
+ return ;
+ },
(Story) => (