New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@ljcl/storybook-addon-cssprops

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ljcl/storybook-addon-cssprops

Interact with css custom properties dynamically in the Storybook UI

  • 2.1.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7K
decreased by-8.87%
Maintainers
1
Weekly downloads
 
Created
Source

Storybook CSS Custom Properties Addon

npm i -D @ljcl/storybook-addon-cssprops

Enable the addon in .storybook/main.js:

module.exports = {
  addons: ["@ljcl/storybook-addon-cssprops"],
};

To use it inside MDX, or when customising the docs page:

import { CssPropsBlock } from "@ljcl/storybook-addon-cssprops";

Usage

Include your CSS Custom Properties without the intial -- prefix, the addon will apply and document this automatically.

export default {
  title: "Simple Component",
  parameters: {
    cssprops: {
      "css-custom-property-1": {
        value: "hsl(120deg 100% 25% / 49%)",
        description: "Optional description",
      },
    }
  },
} as Meta;

Controls default to colour, but can be switched to text by adding cssprops.myparam.control: 'text'.

Disable the picker with cssprops.disable: true

Customise preset colours for the colourpicker with cssprops.presetColors: ['#FFF'].

Adding to DocsPage and MDX

DocsPage

Modify the docs page based by following the storybook docs. Including <CssPropsBlock /> where you prefer.

Development

This monorepo uses npm@7 workspaces, run npm i at the root.

TODO

[] Auto detect input type.
[] Look for the args of a defined component when in MDX
[] Configurable per story localstorage.
[] Better specificity when injecting styles (with & without iframes) [] Functioning reset button.

Credits

Portions of this package are sourced from the storybook source code in order to maintain look and feel.

Keywords

FAQs

Package last updated on 04 May 2022

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