diff --git a/community/components/overlay/modal/modal.stories.ts b/community/components/overlay/modal/modal.stories.ts index 9bee2a71b..841e7144a 100644 --- a/community/components/overlay/modal/modal.stories.ts +++ b/community/components/overlay/modal/modal.stories.ts @@ -104,7 +104,113 @@ class StorybookModalComponent implements OnInit { * * It is also possible to re-use **ModalFooterComponent** and **ModalHeaderComponent** in your own components * with custom arguments, or modified inside the modal component's slots. - * For convenience, you can supply args to all modal components via the `args` input in cdk dialog's `open()` function's option object. + * For convenience, you can supply args to all modal components via the `args` input in cdk dialog's `open()` function's option object, which you can consume in + * + * Keep in mind, **ModalComponent** will not work on it's own, it's intended for the user to create their own wrapper for it that makes use of **ModalHeaderComponent**, + * **ModalFooterComponent** and **ModalComponent** in a separate component, that you will provide into the `this.dialog.open()` call + * + *
+ *Example opening button + *```ts + *@Component({ + * selector: "storybook-open-modal", + * template: ' ', + * imports: [ButtonComponent], + *}) + *class ModalOpenComponent { + * args = input(); + * dialog = inject(Dialog); + * + * openDialog() { + * this.dialog.open(StorybookModalComponent, { + * data: this.args(), + * }); + * } + *} + *``` + * + *
+ * + * + *
+ *Example complete modal + *```ts + *@Component({ + * selector: "storybook-modal", + * template: ' + * + * + * + * + * + * @for (option of options; track option.value) { + * + * } + * + * + * + * + * @for (option of options; track option.value) { + * + * } + * + * + * + * + * ', + * imports: [ + * SelectComponent, + * SelectOptionComponent, + * ModalComponent, + * ModalHeaderComponent, + * ModalFooterComponent, + * FeedbackTextComponent, + * LabelComponent, + * ], + *}) + *class StorybookModalComponent implements OnInit { + * readonly options = [ + * { value: "1", label: "Option 1" }, + * { value: "2", label: "Option 2" }, + * { value: "3", label: "Option 3" }, + * { value: "4", label: "Option 4" }, + * { value: "5", label: "Option 5" }, + * ]; + * + * readonly args = model(); + * + * selectOneId?: string; + * selectTwoId?: string; + * + * ngOnInit(): void { + * this.selectOneId = indexId("select-one"); + * this.selectTwoId = indexId("select-two"); + * } + *} + *``` + *
+ * + *
+ *Example opening action + *```ts + *import { Dialog } from "@angular/cdk/dialog"; + * // Inside your component + * dialog = inject(Dialog); + * this.dialog.open(MyModalComponent, {data}) + *``` + * + *
+ * */ const meta: Meta = { title: "Community/Overlay/Modal",