rsnext/examples/with-carbon-components
2022-05-27 21:21:40 +00:00
..
pages Refactor class components to functional @ examples (#13398) 2020-05-27 05:14:26 +00:00
styles Update examples/with-carbon-components (#15190) 2020-07-17 01:17:58 +00:00
.gitignore Added .gitignore to examples that are deployed to vercel (#15127) 2020-07-16 10:52:23 -04:00
package.json Clean up examples package.json (#27121) 2021-07-12 19:58:03 +00:00
README.md Update pnpm create next-app for latest pnpm 6 and 7 (#37254) 2022-05-27 21:21:40 +00:00

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:

Deploy with Vercel

How to use

Execute create-next-app with npm, Yarn, or pnpm 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
# or
pnpm create next-app --example with-carbon-components with-carbon-components-app

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