The following tasks will help you get started using Design System React within Create React App 1.x.
- Create a new app
create-react-app my-react-app
- Install NPM modules
npm install @salesforce-ux/design-system @salesforce/design-system-react
- Copy SLDS CSS file to
publicfolder/node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css
- Copy SLDS icons folder to
publicfolder/node_modules/@salesforce-ux/design-system/assets/icons
- Add CSS file to
index.html<link rel="stylesheet" type="text/css" href="/salesforce-lightning-design-system.min.css">
- Copy examples from Design System React website into
app.js. - Update imports to named imports (CommonJS build) of Design System React.
import { Button, IconSettings } from '@salesforce/design-system-react';
- Modify the
iconPathprop ofIconSettingsto output the correct path to the icons in the public folder.<IconSettings iconPath="/icons">{// doc site examples}</IconSettings>