{"id":22486627,"url":"https://github.com/gridscale/storybook-addon-cssswitch","last_synced_at":"2025-08-02T19:32:34.031Z","repository":{"id":265113993,"uuid":"895102364","full_name":"gridscale/storybook-addon-cssswitch","owner":"gridscale","description":"storybook addon to switch between css files within a story preview","archived":false,"fork":false,"pushed_at":"2024-12-19T10:40:43.000Z","size":401,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-06-13T14:56:56.495Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gridscale.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-11-27T15:05:18.000Z","updated_at":"2024-12-19T10:40:47.000Z","dependencies_parsed_at":"2024-12-19T11:35:11.179Z","dependency_job_id":"2a7f275d-f8ef-4d6d-8f91-50672725eea0","html_url":"https://github.com/gridscale/storybook-addon-cssswitch","commit_stats":null,"previous_names":["gridscale/storybook-addon-cssswitch"],"tags_count":3,"template":false,"template_full_name":"storybookjs/addon-kit","purl":"pkg:github/gridscale/storybook-addon-cssswitch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridscale%2Fstorybook-addon-cssswitch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridscale%2Fstorybook-addon-cssswitch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridscale%2Fstorybook-addon-cssswitch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridscale%2Fstorybook-addon-cssswitch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gridscale","download_url":"https://codeload.github.com/gridscale/storybook-addon-cssswitch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gridscale%2Fstorybook-addon-cssswitch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268440678,"owners_count":24250859,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-02T02:00:12.353Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-06T17:15:00.889Z","updated_at":"2025-08-02T19:32:34.006Z","avatar_url":"https://github.com/gridscale.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CSS Switcher\n\nThe CSS switcher addon will add a button to your stories toolbar allowing you to switch CSS files during runtime. The CSS files must be loadable per HTTP during runtime, so either provide them thru a static asset directory or on a different host.\nWhen switching the CSS files, a `\u003clink\u003e` tag is dynamically added/modified within the story iframe, while the CSS in the first option will be loaded by default.\n\n## Installation\n\nFirst, install the package.\n\n```sh\nnpm install --save-dev @gridscale/storybook-addon-cssswitch\n```\n\nThen, register it as an addon in `.storybook/main.js`.\n\n```js\n// .storybook/main.ts\n\n// Replace your-framework with the framework you are using (e.g., react-webpack5, vue3-vite)\nimport type { StorybookConfig } from '@storybook/your-framework';\n\nconst config: StorybookConfig = {\n  // ...rest of config\n  addons: [\n    '@storybook/addon-essentials'\n    'storybook-addon-cssswitch', // 👈 register the addon here\n  ],\n};\n\nexport default config;\n```\n\n## Usage\n\nThe primary way to use this addon is to define the `cssswitch` parameter in the preview.ts file. In the option you define\n\n`name` the identifier of the CSS (displayed in the dropdown)\n\n`value` the URL of the CSS (must be available on runtime)\n\n`backgroundColor` a background color which will be applied to the story preview when this css is loaded and is also used for the icon in the dropdown if no `iconColor` given\n\n`iconColor` an optional icon color used for the icon in the dropdown\n\n```js\n// preview.ts\n\n\nconst preview: Preview = {\n  parameters: {\n    // [...]\n    cssswitch: {\n      options: {\n        light: { name: 'light', value: '/assets/variables_light.css', backgroundColor: '#F8F8F8' },\n        dark: { name: 'dark', value: '/assets/variables_dark.css', backgroundColor: '#080808' },\n      }\n    },\n  },\n};\n\nexport default preview;\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgridscale%2Fstorybook-addon-cssswitch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgridscale%2Fstorybook-addon-cssswitch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgridscale%2Fstorybook-addon-cssswitch/lists"}