Skip to content

Commit

Permalink
docs(cdk/dialog): add initial setup instructions for CDK dialogs (#29209
Browse files Browse the repository at this point in the history
)

* docs(cdk/dialog): add initial setup instructions for CDK dialogs

Added instructions for including structural styles required by CDK dialogs. Noted that without importing '@angular/cdk/overlay-prebuilt.css' in the global stylesheet, CDK dialogs did not work correctly.

* docs(cdk/dialog): added cdk.overlay mixin import

Added alternative method for including CDK styles using the cdk.overlay mixin

(cherry picked from commit 35f07c5)
  • Loading branch information
ifrntnd authored and crisbeto committed Jun 8, 2024
1 parent 46afe04 commit 8dbd669
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/cdk/dialog/dialog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
The `Dialog` service can be used to open unstyled modal dialogs and to build your own dialog
services.

### Initial setup
The CDK dialogs depend on a small set of structural styles to work correctly. If you're using
Angular Material, these styles have been included together with the theme, otherwise if you're
using the CDK on its own, you'll have to include the styles yourself. You can do so by importing
the prebuilt styles in your global stylesheet:

```scss
@import '@angular/cdk/overlay-prebuilt.css';
```

Alternatively, you can include the styles using the `cdk.overlay` mixin in your Sass file. You can import the mixin as follows:

```scss
@use '@angular/cdk' as cdk;

@include cdk.overlay();
```

<!-- example(cdk-dialog-overview) -->

You can open a dialog by calling the `open` method either with a component or with a `TemplateRef`
Expand Down

0 comments on commit 8dbd669

Please sign in to comment.