f3f4ca3ef5
The example used an outdated version of carbon components v9. The latest got a huge facelift, new components and a lot of optimizations. I updated the example with carbon-components v10. |
||
---|---|---|
.. | ||
pages | ||
styles | ||
.gitignore | ||
package.json | ||
README.md |
Example app with carbon-components-react
This example features how you use IBM's carbon-components-react (Carbon Design System) with Next.js.
Create your own theme with Carbon Design System's theming tools and put it all together as demonstrated in static/myCustomTheme.scss
Deploy your own
Deploy the example using Vercel:
How to use
Using create-next-app
Execute create-next-app
with npm or Yarn to bootstrap the example:
npx create-next-app --example with-carbon-components with-carbon-components-app
# or
yarn create next-app --example with-carbon-components with-carbon-components-app
Download manually
Download the example:
curl https://codeload.github.com/vercel/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-carbon-components
cd with-carbon-components
Install it and run:
npm install
npm run dev
# or
yarn
yarn dev
Deploy it to the cloud with Vercel (Documentation).
Optimizations
In this example we import carbon components in the styles/custom-theme.scss
file like this:
@import '~carbon-components/scss/globals/scss/styles.scss';
When we start to consider the performance of this approach, however, it becomes clear that this will include every single bit of CSS that Carbon outputs. Sometimes, you totally need everything that the project provides, but for a good number of teams you may find yourself using only a subset of our components. Here is a great article about how you can optimize your application using carbon components: https://medium.com/carbondesign/minimal-css-with-carbon-b0c089ccfa71