Skip to content

About

Design system for Learning Commons Projects

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

33 stars

Watchers

31 watching

Forks

Latest commit

 

History

3,656 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Education Design System

Test CI Release codecov Release GitHub commits since latest release (branch)

The Education Design System (EDS) is a repository of building blocks, implementing the Chan Zuckerberg Initiative Education Design System. It contains:

  • Design Tokens defining the color, sizes, and other details used in the system
  • Tooling/Configuration for using and updating the tokens in a consuming application
  • Presentational components implementing the common controls provided by the EDS toolkit
  • Guidelines for creating recipes using EDS, composing the above components

Prerequisites

Currently, EDS supports the following:

  • React 19 or above (tested with React 19.x)
  • Tailwind 3.x

Browser support

EDS supports the following browsers, on desktop and mobile. The same list is declared as browserslist in package.json.

Browser Minimum version
Chrome 123
Edge 123
Firefox 128
Safari 17.5
Safari (iOS) 17.5

These features set the floor:

Feature Used by Chrome / Edge Firefox Safari
CSS light-dark() Theming (body.css, component styles) 123 120 17.5
Intl.Segmenter Avatar 87 125 14.1
CSS relative colors (rgb(from …)) Avatar, Modal, ScrollWrapper 119 128 16.4

Vite 8 and Lightning CSS

Vite 8 minifies CSS with Lightning CSS, which lowers syntax to build.cssTarget. The default target sits below light-dark() support, so Vite rewrites EDS's light-dark() into --lightningcss-light / --lightningcss-dark variable fallbacks. Set build.cssTarget to the EDS floor to keep it native:

// vite.config.ts
export default defineConfig({
  build: {
    cssTarget: ['chrome123', 'edge123', 'firefox128', 'safari17.5', 'ios17.5'],
  },
});

css.lightningcss.targets doesn't help here: Vite's minifier overrides it with build.cssTarget.

Installation

First, install the package.

# using npm
npm install --save @chanzuckerberg/eds

# or using Yarn
yarn add @chanzuckerberg/eds

Setting up EDS in your project

Import the EDS stylesheets somewhere in your app root, e.g. an init.ts or app.ts file:

import '@chanzuckerberg/eds/index.css'; // Includes relevant styles and tokens for EDS

Also, include this in your base / reset styles to allow configuation of the pixel-to-rem ratio:

html {
  font-size: calc(var(--eds-typography-base-size) * 1px); /* Sets the default pixel-to-rem ratio */
  /* also set a default html/body font family, if desired by using --eds-typography-font-family-1, etc. */
}

Lastly, add <link> or other files to load fonts into your project. EDS provides fallbacks for the three font families, and can support fonts from Adobe, Google, or other hosting / local sources:

<!-- Handling for font-family-1 : local file --> 
<link rel="stylesheet" href="https://local-domain.org/fonts.css">

<!-- Handling for font-family-2 : adobe font -->
<link rel="stylesheet" href="https://use.typekit.net/<example>.css">

<!-- Handling for font-family-3 : google font-->
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=<test-font-family...>" rel="stylesheet">

Theming Setup

For more information and configuration options, read the Theming Overview.

Semantic Icon Setup

A few icons are EDS's own rather than yours to pass in: the close button on a Modal, the chevron marking a Menu.Button as expandable, the icon carrying a notification's status. Each marks one role, and a role only reads as itself if it looks the same everywhere it appears, so they come from IconProvider instead of from props on each component.

Every role ships with a default, so skip this if those suit you. To change one, wrap your app once and name only the roles you want to differ:

import { IconProvider } from '@chanzuckerberg/eds';

// Defined outside render: a new object on every render re-renders everything below it.
const icons = { back: 'arrow-left', expand: 'unfold-more' };

<IconProvider icons={icons}>
  <App />
</IconProvider>;

Each role takes an EDS icon name or a node, and anything left out keeps the icon it had. For the full list of roles and their defaults, read the IconProvider docs.

EDS Component Usage

Import any of the components from the top-level package:

// Import components by name at the top of your file
import { Heading } from '@chanzuckerberg/eds';

// ...and then use them in your React components:

<Heading preset="headline-lg">
  Coffee!
</Heading>

EDS provides a suite of components for use, and documentation for available props and overrides.

Development

This project is under active development. See CONTRIBUTING.md for more information on how to contribute to the Design System and IDE (VSCode) setup. Also, read our guidelines for additional information on how we build EDS components.

Instead, if you want to report an issue, you can open an issue.

This project is governed under the Contributor Covenant code of conduct.

Reporting Security Issues

See our Security Readme.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to opensource@chanzuckerberg.com.

About

Design system for Learning Commons Projects

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

33 stars

Watchers

31 watching

Forks

Releases

Packages

Used by

Contributors

Languages