slug | sidebar_position |
---|---|
/ |
1 |
Stellar Design System (SDS) is an opinionated React component library (we hope it will grow into a full-featured design system in the future) used in the Stellar Development Foundation’s web projects. It's meant to be used internally to keep our web products consistent.
- TypeScript
- React for UI
- Sass for CSS styling
- Yarn
- Rollup
Install SDS by using the package manager of your choice.
npm install @stellar/design-system
Add Google Fonts (Inter
and Inconsolata
) to the index.html
file or
CSS/styles file.
<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=Inter:wght@100..900&family=Inconsolata:wght@500&display=swap"
rel="stylesheet"
/>
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@100..900&family=Inconsolata:wght@500&display=swap");
Add the main CSS file to your project (for example, the main index
file of
your React project).
import "@stellar/design-system/build/styles.min.css";
Import components in your project.
import { Button, Input } from "@stellar/design-system";
The design system repo has two parts:
@stellar/design-system
- everything for the design system (repo)@stellar/design-system-website
- website for the design system (what you are looking at now) (repo)
To run Stellar Design System locally:
- Clone the repo
git clone git@github.com:stellar/stellar-design-system.git
- Install dependencies
npm install
build:sds
- build Stellar Design System (sds) project onlybuild:sds-web
- build Stellar Design System website (sds-web) project onlybuild
- build both projectsstart:sds
- start sds project for local developmentstart:sds-web
- start sds-web project for local developmentclean
- delete node_modules and build directories in the whole repo
:::info
You need to run each start
command in its own window or tab.
:::
- Use the Stellar Design System components "as is", don’t modify existing ones to fit your needs if the component doesn’t allow it.
- If a component doesn’t exist, it’s okay to create it locally for your project (we’ll keep adding more components to SDS as we go).
- If you are creating a component locally, use only color variables available in
the SDS palette (in
theme.scss
). This is very important for the light and dark modes to work. When in doubt, please check with the Design team. styled-components
are not currently supported, but you can use them as wrappers/containers for SDS components.