Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@storybook/addon-measure
Advanced tools
Inspect layouts by visualizing the box model
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.
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 />;
Similar to @storybook/addon-measure, @storybook/addon-outline provides visual tools to enhance UI development in Storybook. While @storybook/addon-measure focuses on measuring and spacing, @storybook/addon-outline helps by drawing outlines around components, which is useful for visual debugging of layout and container boundaries.
This addon is used to embed Figma or Sketch designs next to your Storybook stories, facilitating a side-by-side comparison between design files and implemented components. Unlike @storybook/addon-measure, which is more focused on in-story measurements, storybook-addon-designs bridges the gap between design and development by directly integrating design visuals.
Storybook addon for inspecting layouts and visualizing the box model.
Press the m key to enable the addon:
Hover over a DOM node
Storybook will display the dimensions of the selected element—margin, padding, border, width and height—in pixels.
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'],
};
FAQs
Inspect layouts by visualizing the box model
The npm package @storybook/addon-measure receives a total of 4,838,093 weekly downloads. As such, @storybook/addon-measure popularity was classified as popular.
We found that @storybook/addon-measure demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
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.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.