Skip to content

Commit 8478452

Browse files
authored
feat: add dialog title, header and footer renderers (#3623)
1 parent e576f05 commit 8478452

21 files changed

Lines changed: 897 additions & 44 deletions

‎packages/dialog/src/vaadin-dialog.d.ts‎

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,23 @@ export type DialogEventMap = HTMLElementEventMap & DialogCustomEventMap;
9494
* See [`<vaadin-overlay>`](#/elements/vaadin-overlay) documentation.
9595
* for `<vaadin-dialog-overlay>` parts.
9696
*
97+
* In addition to `<vaadin-overlay>` parts, the following parts are available for styling:
98+
*
99+
* Part name | Description
100+
* -----------------|-------------------------------------------
101+
* `header` | Element wrapping title and header content
102+
* `header-content` | Element wrapping the header content slot
103+
* `title` | Element wrapping the title slot
104+
* `footer` | Element wrapping the footer slot
105+
*
106+
* The following state attributes are available for styling:
107+
*
108+
* Attribute | Description
109+
* -----------------|--------------------------------------------
110+
* `has-title` | Set when the element has a title
111+
* `has-header` | Set when the element has header renderer
112+
* `has-footer` | Set when the element has footer renderer
113+
*
97114
* Note: the `theme` attribute value set on `<vaadin-dialog>` is
98115
* propagated to the internal `<vaadin-dialog-overlay>` component.
99116
*
@@ -136,14 +153,52 @@ declare class Dialog extends ThemePropertyMixin(ElementMixin(DialogDraggableMixi
136153
*/
137154
renderer: DialogRenderer | null | undefined;
138155

156+
/**
157+
* String used for rendering a dialog title.
158+
*
159+
* If both `headerTitle` and `headerRenderer` are defined, the title
160+
* and the elements created by the renderer will be placed next to
161+
* each other, with the title coming first.
162+
*
163+
* When `headerTitle` is set, the attribute `has-title` is added to the overlay element.
164+
* @attr {string} header-title
165+
*/
166+
headerTitle: string | null | undefined;
167+
168+
/**
169+
* Custom function for rendering the dialog header.
170+
* Receives two arguments:
171+
*
172+
* - `root` The root container DOM element. Append your content to it.
173+
* - `dialog` The reference to the `<vaadin-dialog>` element.
174+
*
175+
* If both `headerTitle` and `headerRenderer` are defined, the title
176+
* and the elements created by the renderer will be placed next to
177+
* each other, with the title coming first.
178+
*
179+
* When `headerRenderer` is set, the attribute `has-header` is added to the overlay element.
180+
*/
181+
headerRenderer: DialogRenderer | null | undefined;
182+
183+
/**
184+
* Custom function for rendering the dialog footer.
185+
* Receives two arguments:
186+
*
187+
* - `root` The root container DOM element. Append your content to it.
188+
* - `dialog` The reference to the `<vaadin-dialog>` element.
189+
*
190+
* When `footerRenderer` is set, the attribute `has-footer` is added to the overlay element.
191+
*/
192+
footerRenderer: DialogRenderer | null | undefined;
193+
139194
/**
140195
* Set to true to remove backdrop and allow click events on background elements.
141196
*/
142197
modeless: boolean;
143198

144199
/**
145-
* Requests an update for the content of the dialog.
146-
* While performing the update, it invokes the renderer passed in the `renderer` property.
200+
* While performing the update, it invokes the renderer passed in the `renderer` property,
201+
* as well as `headerRender` and `footerRenderer` properties, if these are defined.
147202
*
148203
* It is not guaranteed that the update happens immediately (synchronously) after it is requested.
149204
*/

0 commit comments

Comments
 (0)