Carbon Design System

repository·main·Indexed 11 days ago

https://github.com/carbon-design-system/carbon

IBM's open-source design system for building consistent products and experiences. It provides a monorepo containing React and Web Component libraries, design tokens, Sass styles, icons, and layout utilities, along with standardized configurations for ESLint, Prettier, Jest, Stylelint, TypeScript, and Browserslist.

Tokens
328.7K
Snippets
1.1K
Records
1.7K
Agent score
93%

What's inside Carbon

  1. Overview of @carbon/layout features

    main

    The @carbon/layout package provides layout helpers and specifications for the IBM Design Grid. It is available in both Sass and JavaScript.

    Note: This package does not provide the grid implementation itself. For the grid implementation, use the @carbon/grid package.

    Key features include:

    • Breakpoints: Variables and settings for the IBM Design Grid (gutters, breakpoints) and helpers for working with them.
    • Unit conversion: Helpers for converting between px, rem, and em.
    • Key heights: Helpers for managing key heights across different breakpoints.
    • Mini unit: Helpers for working in multiples of the mini-unit.
    • Spacing: A spacing scale and helpers for using steps within that scale.
  2. Overview of the Toggle web component

    main

    The cds-toggle component is a web component used to represent a binary choice (on/off). It is part of the Carbon Design System web components library.

    Common usage patterns include:

    • Small Toggle: A compact version of the toggle.
    • Skeleton: A version used for loading states.
    • Accessible Labels: Using accessible labels to ensure the component is usable by assistive technologies.
  3. What is @carbon/icon-build-helpers used for?

    main

    The @carbon/icon-build-helpers module is a private utility used within the Carbon Design System monorepo to centralize icon-related tooling. It provides the logic for:

    • Asset Processing: Searching directories of .svg assets and structuring them by size and prefixes.
    • Custom Builders: Generating icon libraries for various targets, specifically Vanilla and React.
    • CI Validation: Implementing repository status checks for icon metadata files, specifically metadata.yml and categories.yml.

    This tooling powers the generation of the following SVG-based projects:

    • @carbon/icons
    • @carbon/icons-react
    • @carbon/pictograms
    • @carbon/pictograms-react
  4. Overview of @carbon/styles

    main

    The @carbon/styles package provides the Sass files required to include all styles for the Carbon Design System, including themes, tokens, CSS helpers, and components.

    Important Note for @carbon/react users: You may not need to install @carbon/styles separately if you are already using @carbon/react. The module paths in @carbon/styles and @carbon/react are synonymous, as @carbon/react re-exports everything from @carbon/styles. For example, @carbon/styles/scss/components/button is equivalent to @carbon/react/scss/components/button.

  5. Overview of Carbon Design System packages

    main

    Carbon is IBM's open-source design system. This monorepo provides a comprehensive suite of tools for building products and experiences, including React and Web Component libraries, Sass styles, design tokens, icons, and pictograms.

    Key packages include:

    • @carbon/react: React components and styles.
    • @carbon/web-components: Standards-based web components.
    • @carbon/colors: Color scales and color token utilities.
    • @carbon/elements: IBM Design Language foundations (tokens and assets).
    • @carbon/grid: Layouts built on Carbon's grid.
    • @carbon/icons: Icon assets and framework packages (supports React and Vue).
    • @carbon/layout: Layout units and spacing scale tokens.
    • @carbon/motion: Productive and expressive motion curves.
    • @carbon/pictograms: Pictogram assets (includes React support).
    • @carbon/styles: Sass styles for Carbon components.
    • @carbon/themes: Theme tokens for Carbon color systems.
    • @carbon/type: Type tokens designed for IBM Plex.

    Community-maintained packages are also available for Angular, Svelte, and Vue.

  6. Overview of the Modal component

    main

    The <Modal> component allows you to render a bespoke set of contents within a modal overlay. The children prop is used to map to the modal body content. You can customize the text for various parts of the modal using the following props:

    • modalLabel: Text for the modal label.
    • modalHeading: Text for the modal heading.
    • secondaryButtonText: Text for the secondary action button.
    • primaryButtonText: Text for the primary action button.
  7. Overview of the Menu component

    main

    The Menu component implements the menu design pattern defined in the ARIA Authoring Practices Guide (APG). It is a versatile component designed to hold various subcomponents that represent different types of menu interactions.

    To build a valid Menu, its children must be a collection of the following subcomponents:

    • MenuItem
    • MenuItemDivider
    • MenuItemGroup
    • MenuItemSelectable
    • MenuItemRadioGroup
  8. Overview of Figma Code Connect for @carbon/react

    main

    Figma Code Connect for Carbon React links Carbon v11 All themes Figma library components directly to their @carbon/react counterparts.

    When integrated into a workflow, Figma's Dev Mode displays actual code snippets from Carbon React instead of generic placeholders. It also maps properties from Carbon React code to Figma, allowing for dynamic and accurate code examples in the design tool, which helps maintain consistency between design and engineering.