Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
@carbon/layout
Advanced tools
Layout helpers for digital and software products using the Carbon Design System
@carbon/layout is a package that provides layout utilities for building responsive and consistent layouts in web applications. It is part of the Carbon Design System, which is IBM's open-source design system for digital products and experiences.
Spacing Scale
The spacing scale provides a set of predefined spacing values that can be used to maintain consistent spacing throughout your application. The values are based on a modular scale.
const { spacing } = require('@carbon/layout');
console.log(spacing[3]); // Outputs: '1rem'
Breakpoints
Breakpoints define the various screen sizes at which your layout should adapt. These predefined breakpoints help in creating responsive designs.
const { breakpoints } = require('@carbon/layout');
console.log(breakpoints.md.width); // Outputs: '672px'
Layout Grid
The layout grid provides a set of predefined column widths that can be used to create grid-based layouts. This helps in maintaining a consistent structure across different pages.
const { layout } = require('@carbon/layout');
console.log(layout['2-3']); // Outputs: '66.66667%'
Bootstrap is a popular front-end framework that includes a comprehensive grid system, responsive breakpoints, and utility classes for spacing and layout. It is more feature-rich compared to @carbon/layout but also more complex.
Tailwind CSS is a utility-first CSS framework that provides low-level utility classes for spacing, layout, and more. It offers more flexibility and customization options compared to @carbon/layout but requires a different approach to styling.
Foundation is another front-end framework that includes a responsive grid system, breakpoints, and utility classes for layout. It is similar to Bootstrap but with a different design philosophy and set of components.
Layout helpers for digital and software products using the Carbon Design System
To install @carbon/layout
in your project, you will need to run the following
command using npm:
npm install -S @carbon/layout
If you prefer Yarn, use the following command instead:
yarn add @carbon/layout
@carbon/layout
provides a couple of useful utilities alongside the
specification for the grid system for the IBM Design Language. This package
includes:
Feature | Description |
---|---|
Breakpoints | Variables and settings for the IBM Design Grid, including gutter and breakpoints. It also includes helpers for working with breakpoints |
Unit conversion | Helpers for converting from px to rem or em . |
Key heights | Helpers for working with key heights at different breakpoints |
Mini unit | Helpers for working in multiples of the mini-unit |
Spacing | Provides a spacing scale and helper for using steps in the scale |
One important thing to remember is that @carbon/layout
is not responsible for
the grid itself. If you are looking for a grid implementation to use, definitely
check out the @carbon/grid
package.
@carbon/layout
provides the above features in both Sass and JavaScript. If
you're looking for support in a different language, feel free to file an issue
proposing the new addition!
We're always looking for contributors to help us fix bugs, build new features, or help us improve the project documentation. If you're interested, definitely check out our Contributing Guide! 👀
Licensed under the Apache 2.0 License.
This package uses IBM Telemetry to collect de-identified and anonymized metrics data. By installing this package as a dependency you are agreeing to telemetry collection. To opt out, see Opting out of IBM Telemetry data collection. For more information on the data being collected, please see the IBM Telemetry documentation.
FAQs
Layout helpers for digital and software products using the Carbon Design System
The npm package @carbon/layout receives a total of 54,181 weekly downloads. As such, @carbon/layout popularity was classified as popular.
We found that @carbon/layout demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 13 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
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.