Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@storybook/addon-styling

Package Overview
Dependencies
Maintainers
30
Versions
130
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storybook/addon-styling

A base addon for configuring popular styling tools

  • 0.3.0-canary.4.7fc78e3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
241K
decreased by-1.73%
Maintainers
30
Weekly downloads
 
Created
Source

@storybook/addon-styling

Get started in Storybook faster with popular styling tools.

Toggling between themes

✨ Features

  • 🧩 Configuration templates for popular tools
  • 🎨 Provide themes
  • 🔄 Toggle between multiple themes when more than one is provided
  • ❗️ Override theme at the component and story level through parameters

🏁 Getting Started

To get started, install the package as a dev dependency

yarn:

yarn add -D @storybook/addon-styling

npm:

npm install -D @storybook/addon-styling

pnpm:

pnpm add -D @storybook/addon-styling

Then, include the addon in your .storybook/main.js file

module.exports = {
  stories: [
    "../stories/**/*.stories.mdx",
    "../stories/**/*.stories.@(js|jsx|ts|tsx)",
  ],
  addons: [
    "@storybook/addon-essentials",
+   "@storybook/addon-styling"
  ],
};

👇 Tool specific configuration

For tool-specific setup, check out the recipes below

  • @emotion/styled
  • @mui/material
  • bootstrap
  • styled-components
  • tailwind
  • Vuetify 3

Don't see your favorite tool listed? Don't worry! That doesn't mean this addon isn't for you. Check out the "Writing a custom decorator" section of the api reference.

❗️ Overriding theme

If you want to override your theme for a particular component or story, you can use the theming.themeOverride parameter.

import React from "react";
import { Button } from "./Button";

export default {
  title: "Example/Button",
  component: Button,
  parameters: {
    theming: {
      themeOverride: "light", // component level override
    },
  },
};

const Template = (args) => <Button {...args} />;

export const Primary = Template.bind({});
Primary.args = {
  primary: true,
  label: "Button",
};

export const PrimaryDark = Template.bind({});
PrimaryDark.args = {
  primary: true,
  label: "Button",
};
PrimaryDark.parameters = {
  theming: {
    themeOverride: "dark", // Story level override
  },
};

🤝 Contributing

If you'd like to contribute to this addon, THANK YOU, I'd love your help 🙏

📝 Development scripts

  • yarn start runs babel in watch mode and starts Storybook
  • yarn build build and package your addon code

Keywords

FAQs

Package last updated on 02 Mar 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc