Carbon Components React
List of Available Components
View available React Components here. You can see usage information in several ways:
- Clicking the blue Show Info icon in the top right corner of the selected component. You can see the list of available React props
- Clicking the STORY tab at the bottom. This tab contains the code that shows how the component is being used
- Clicking the KNOBS tab at the bottom and changing values there. Most knobs are shown as something like
Button kind (kind), where
kindis the name of React prop
- Clicking the ACTION LOGGER tab at the bottom and interacting with the selected component. You may see something like
onClickwhich typically indicates that the event handler (React prop) with the same name is called. You can also expand the twistie to see the details of the event
- Clicking the README tab at the bottom. You can see some more document for some components
Run the following command using npm:
npm install -S carbon-components-react carbon-components carbon-icons
If you prefer Yarn, use the following command instead:
yarn add carbon-components-react carbon-components carbon-icons
Components do not import any of the styles themselves, use the scss or css from
carbon-componentsto bring in styling. You can also use the
unpkgcdn to bring in the styles wholesale -
unpkg.com/carbon-components/css/carbon-components.cssaliases the latest css file.
For older browsers (e.g. IE11), polyfills listed in
carbon-components-react/.storybook/polyfills.jsfile is required.
If you just want to try out
carbon-components-react, you can also use CodeSandbox.
Please refer to the Contribution Guidelines before starting any work.
Using the server
We recommend the use of React Storybook for developing components.
(Optional) Set environment variables:
CARBON_USE_EXPERIMENTAL_FEATURESenvironment variable to test some of the experimental features:
$ export CARBON_USE_EXPERIMENTAL_FEATURES=true
CARBON_REACT_STORYBOOK_USE_EXTERNAL_CSSenvironment variable to use external CSS, making style source link usable in DOM inspector:
$ export CARBON_REACT_STORYBOOK_USE_EXTERNAL_CSS=true
CARBON_REACT_STORYBOOK_USE_STYLE_SOURCEMAPenvironment variable to use Sass source map, making style source link point to the original Sass code:
$ export CARBON_REACT_STORYBOOK_USE_STYLE_SOURCEMAP=true
CARBON_REACT_STORYBOOK_USE_STYLE_SOURCEMAP=truemake WebPack builds slightly slower.
CARBON_REACT_STORYBOOK_USE_STYLE_SOURCEMAP=true, the source map (hitting style source link in DOM inspector) sometimes leads you to a mix-in, instead of a style rule calling the mix-in, which may get you lost.
Start the server:
$ yarn storybook
Open browser to
Develop components in their respective folders (
Write stories for your components in
Please check out our Contribution Guidelines for detailed information on how you can lend a hand.
To update the
Contributors section, follow these instructions
Thanks goes to these wonderful people: