The following tasks will help you get started using Design System React within Create React App 1.x.
Do you have tips to share with other Create React Users users? Please share with the rest of the Create React community and add to the list below.
- Create a new app
create-react-app my-react-app
- Install NPM modules
cd my-react-app && npm install @salesforce-ux/design-system @salesforce/design-system-react
- Copy SLDS CSS file to
public
foldercp node_modules/@salesforce-ux/design-system/assets/styles/salesforce-lightning-design-system.min.css public/
- Copy SLDS icons folder to
public
foldercp -r node_modules/@salesforce-ux/design-system/assets/icons public/
- Copy SLDS fonts folder to
public
foldercp -r node_modules/@salesforce-ux/design-system/assets/fonts public/
- 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
iconPath
prop ofIconSettings
to output the correct path to the icons in the public folder.<IconSettings iconPath="/icons">{// doc site examples}</IconSettings>