Socket
Socket
Sign inDemoInstall

@storybook/addon-measure

Package Overview
Dependencies
2
Maintainers
26
Versions
877
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @storybook/addon-measure

Inspect layouts by visualizing the box model


Version published
Weekly downloads
4.7M
increased by0.28%
Maintainers
26
Created
Weekly downloads
 

Package description

What is @storybook/addon-measure?

The @storybook/addon-measure npm package is a Storybook addon used for measuring and inspecting elements in a Storybook UI. This tool is particularly useful for developers and designers to ensure precise visual consistency directly within the Storybook environment. It allows users to measure dimensions, spacing, and alignment of components during the development process.

What are @storybook/addon-measure's main functionalities?

Element Measurement

This feature allows users to measure the dimensions and spacing of components. By adding the withMeasure decorator, users can toggle measurement tools in the Storybook UI to inspect the component presented in the story.

import { withMeasure } from '@storybook/addon-measure';

export default {
  title: 'Your Component',
  decorators: [withMeasure]
};

export const YourStory = () => <YourComponent />;

Alignment Inspection

This feature enables users to check the alignment of elements within components. The decorator adds visual guides that help in aligning text, icons, or other elements accurately within the component.

import { withMeasure } from '@storybook/addon-measure';

export default {
  title: 'Another Component',
  decorators: [withMeasure]
};

export const AnotherStory = () => <AnotherComponent />;

Other packages similar to @storybook/addon-measure

Changelog

Source

7.6.10

  • CLI: Fix existing version detection in upgrade - #25642, thanks @JReinhold!
  • React: Fix acorn ecma version warning - #25634, thanks @dannyhw!

Readme

Source

Storybook Addon Measure

Storybook addon for inspecting layouts and visualizing the box model.

  1. Press the m key to enable the addon:

  2. Hover over a DOM node

  3. Storybook will display the dimensions of the selected element—margin, padding, border, width and height—in pixels.

Usage

This addon requires Storybook 6.3 or later. Measure is part of essentials and so is installed in all new Storybooks by default. If you need to add it to your Storybook, you can run:

npm i -D @storybook/addon-measure

Add "@storybook/addon-measure" to the addons array in your .storybook/main.js:

export default {
  addons: ['@storybook/addon-measure'],
};

Inspiration

Keywords

FAQs

Last updated on 18 Jan 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc