Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth mentioning that one can also get these styles by including the cdk.overlay mixin.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@crisbeto I've updated the instructions to include an alternative method using the cdk.overlay mixin in Sass.


```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
Loading