You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Welcome to the project! :wave: This library is the [React](https://facebook.github.io/react/) implementation of the [Salesforce Lightning Design System](https://www.lightningdesignsystem.com/). It has been tested with React >=15.4.1 <16 and is stable despite its version numbers. A 1.0 will be released soon.
15
+
Welcome to the project! :wave: This library is the [React](https://facebook.github.io/react/) implementation of the [Salesforce Lightning Design System](https://www.lightningdesignsystem.com/). This library has a peer dependency on `@salesforce-ux/design-system`, `react`, and `react-dom`. It has been tested with React >=15.4.1 <16 and is stable despite its version number. A 1.0 will be released soon.
*[Documentation and examples](https://react.lightningdesignsystem.com)
19
+
*[Documentation and interactive examples](https://react.lightningdesignsystem.com)
13
20
*[Contributing](CONTRIBUTING.md)
14
21
*[Codebase Overview](docs/codebase-overview.md)
15
22
*[Usage with Webpack](docs/webpack.md)
16
23
17
-
#### ECMAScript 6, CommonJS and `create-react-app`
24
+
###Quick Setup (CommonJS)
18
25
19
-
It is highly recommended that you `npm install` the `-es` suffixed tag and import individual components. You will need a [stage-1 and higher proposed features](https://babeljs.io/docs/plugins/preset-stage-1/) transpiler ([stage-1 Babel preset](https://www.npmjs.com/package/babel-preset-stage-1) or review our `.babelrc`) and include transpiling the `node_modules/design-system-react` folder in your configuration. The non-suffixed package is a [CommonJS](https://nodejs.org/docs/latest/api/modules.html) build that should allow dropping dead code, but not tree-shaking.
26
+
A CommonJS-compatible version has been included within the NPM package to allows usage without transpiling. Use the following named `import` syntax to access CommonJS components from `/lib/index.js`:
27
+
28
+
```
29
+
import { Button } from 'design-system-react';
30
+
31
+
<Button label="Hello Button" />
32
+
```
20
33
21
-
_`create-react-app` and any environment that does not transpile or let you transpile ES6 code within the `node_modules` folder is not compatible with the `-es` suffixed tag. Please use the non-suffixed CommonJS tag until an NPM module is published that is compatible with `create-react-app`._
34
+
### Recommended Usage (ES6 modules)
22
35
23
-
### Local development Storybook and in-browser test server
36
+
Recommended usage requires that your babel presets are set up correctly. `create-react-app`and environments that do not transpile code within `node_modules` are not compatible with the component import below. All the examples on the [documentation site](https://react.lightningdesignsystem.com/) use this syntax. You can use the Babel preset, `@salesforce/babel-preset-design-system-react`, to get started. [This preset](npmjs.com/package/@salesforce-ux/babel-preset-design-system-react) will keep Babel compatible with Design System React and allow ES6 module benefits such as tree-shaking.
24
37
25
38
```
26
-
npm install
27
-
npm start
28
-
open http://localhost:9001 http://localhost:8001
39
+
import Button from 'design-system-react/components/button';
Prior to v0.7.0, SLDS icons were bundled with the JavaScript. The 400KB+ icons bundle from [SLDS](https://www.lightningdesignsystem.com/) is no longer included. You will need to download the SLDS CSS and icons separately.
34
55
35
-
#### Serve icons publically
56
+
#### Serve icons publicly
36
57
37
58
Typically, scripts should be downloaded in the background without blocking the DOM. With React, this works best with [server side rendering](https://reactjs.org/docs/react-dom-server.html#rendertostaticmarkup). SLDS recommends placeholder stencils while scripts are initializing if the HTML cannot be served immediately. If you can serve the HTML, then icon SVGs should not be bundled and served like any other file. Set a path `context` for all child components with `<IconSettings>` at the top of your render tree:
38
59
@@ -46,7 +67,7 @@ ReactDOM.render(
46
67
document.getElementById('app')
47
68
)
48
69
49
-
// `/assets/icons` wil be prepended to `/standard-sprite/svg/symbols.svg#account` within the SVG path
70
+
// `/assets/icons` will be prepended to `/standard-sprite/svg/symbols.svg#account` within the SVG path
Please read the [CONTRIBUTING.md](CONTRIBUTING.md) and [Test README](/tests/README.md) first. Then, create an issue to tell others you are working on a bug. If you would like to contribute a new component, create an issue with a list of proposed props to discuss with maintainers. Issues not addressed with pull requests may be closed eventually. Check out [who's contributing](https://github.com/salesforce/design-system-react/graphs/contributors) to the project.
* Tailored for building Salesforce apps: Using Design System React ensures that your app's UI reflect the Salesforce Lightning look, feel, and behaviors.
6
-
* Continuously updated: As long as you’re using the latest version of Design System React, your pages are always up to date with Salesforce UI changes.
[Design System React website](https://react.lightningdesignsystem.com/)
11
+
## Getting Started
11
12
12
-
[Salesforce Lightning Design System website](https://www.lightningdesignsystem.com/)
13
+
Welcome to the project! :wave: This library is the [React](https://facebook.github.io/react/) implementation of the [Salesforce Lightning Design System](https://www.lightningdesignsystem.com/). This library has a peer dependency on `@salesforce-ux/design-system`, `react`, and `react-dom`.
*[Documentation and interactive examples](https://react.lightningdesignsystem.com)
17
+
18
+
### Quick Setup (CommonJS)
19
+
20
+
A CommonJS-compatible version has been included within the NPM package to allows usage without transpiling. Use the following named `import` syntax to access CommonJS components from `/lib/index.js`:
21
+
22
+
```
23
+
import { Button } from 'design-system-react';
24
+
25
+
<Button label="Hello Button" />
26
+
```
27
+
28
+
### Recommended Usage (ES6 modules)
29
+
30
+
Recommended usage requires that your babel presets are set up correctly. `create-react-app` and environments that do not transpile code within `node_modules` are not compatible with the component import below. All the examples on the [documentation site](https://react.lightningdesignsystem.com/) use this syntax. You can use the Babel preset, `@salesforce/babel-preset-design-system-react`, to get started. [This preset](npmjs.com/package/@salesforce-ux/babel-preset-design-system-react) will keep Babel compatible with Design System React and allow ES6 module benefits such as tree-shaking.
31
+
32
+
```
33
+
import Button from 'design-system-react/components/button';
* Source code is licensed under [BSD 3-Clause](https://git.io/sfdc-license)
49
+
* All icons and images are licensed under [Creative Commons Attribution-NoDerivatives 4.0](https://github.com/salesforce/licenses/blob/master/LICENSE-icons-images.txt)
50
+
* The Salesforce Sans font is licensed under our [font license](https://github.com/salesforce/licenses/blob/master/LICENSE-font.txt)
51
+
52
+
## Got feedback?
53
+
54
+
If you have support questions, please post a question to [StackOverflow](https://stackoverflow.com/questions/tagged/design-system-react) and tag with `design-system-react`. If you find any bugs, create a [GitHub Issue](https://github.com/salesforce/design-system-react/issues).
0 commit comments