Skip to content

Commit 988e9aa

Browse files
committed
Merge branch 'master' of https://github.com/carbon-design-system/carbon-components-angular into next-to-master
2 parents 65df40e + a6ec369 commit 988e9aa

28 files changed

+4005
-3390
lines changed

README.md

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,37 @@ Assuming we're starting with a new @angular/cli project:
2929
```shell
3030
$ npx @angular/cli new my-project --style=scss
3131
$ cd my-project
32-
$ npm i --save carbon-components-angular @carbon/styles
32+
$ npm i --save carbon-components-angular @carbon/styles @carbon/icons
3333
```
3434

35-
Then we need to include carbon-components in `src/styles.scss`:
35+
Next, we need to include carbon styles in `src/styles.scss`:
3636

3737
```scss
38-
@use "@carbon/styles";
38+
@use '@carbon/styles/scss/config' with (
39+
// Use flexbox for grid - stick to CSS Grid or Flexbox
40+
// CSS Grid has become the default grid system in v11
41+
$use-flexbox-grid: true,
42+
// Update path of fonts to exclude tilde, required for vite (Angular 16+)
43+
$font-path: '@ibm/plex'
44+
);
45+
46+
@use '@carbon/styles';
47+
48+
// Import css variables in root
49+
html {
50+
@include styles.theme(styles.$white);
51+
}
3952
```
4053

41-
> *Note:* For offline usage we'll need to set `$font-path: '~carbon-components/src/globals/fonts';` at the very top of our `src/styles.scss`. This will copy the fonts to our `dist` folder upon successful build. If you like the fonts to be a part of your `assets` folder and not pollute the `dist` folder then copy the fonts from `node_modules/carbon-components/src/globals/fonts` into our app's `src/assets/fonts` folder and add `$font-path: '/assets/fonts/';` at the very top of our `src/styles.scss`.
54+
Then we need to declare `@carbon/icons` as a module by creating a `module.d.ts` file (or use any existing declaration file - has `.d.ts` suffix) in your src directory:
55+
56+
```ts
57+
declare module '@carbon/icons/*';
58+
```
4259

4360
That's it! Now we can run `npm start` and start building out our application!
4461

45-
> *Note:* This isn't the only way to bootstrap a `carbon-components-angular` application, but the combination of `@angular/cli` and the `carbon-components` scss is our recommended setup.
62+
> *Note:* This isn't the only way to bootstrap a `carbon-components-angular` application, but the combination of `@angular/cli` and the `@carbon/styles` scss is our recommended setup.
4663
4764
[![Edit Carbon Components Angular](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/edit/stackblitz-starters-exxkq4?file=src%2Fmain.ts)
4865

@@ -172,4 +189,4 @@ This package uses IBM Telemetry to collect de-identified and anonymized metrics
172189
this package as a dependency you are agreeing to telemetry collection. To opt out, see
173190
[Opting out of IBM Telemetry data collection](https://github.com/ibm-telemetry/telemetry-js/tree/main#opting-out-of-ibm-telemetry-data-collection).
174191
For more information on the data being collected, please see the
175-
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).
192+
[IBM Telemetry documentation](https://github.com/ibm-telemetry/telemetry-js/tree/main#ibm-telemetry-collection-basics).

0 commit comments

Comments
 (0)