Skip to content

Commit bc67a2d

Browse files
authored
feat(modal): new props for adding classes to header, body and footer (bootstrap-vue#1462)
* feat(modal): new props for adding classes to header, body and footer * Update README.md
1 parent 9bc454d commit bc67a2d

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/components/modal/README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ methods: {
172172
```
173173

174174

175-
## Prevent Closing
175+
### Prevent Closing
176176

177177
To prevent `<b-modal>` from closing (for example when validation fails). you can call
178178
the `preventDefault()` method of the event object passed to your `ok` (**OK** button),
@@ -407,6 +407,9 @@ export default {
407407
<!-- modal-variant-1.vue -->
408408
```
409409

410+
You can also apply abritrary classes to the modal header, body and footer via the
411+
`header-class`, `body-class` and `footer-class` props, respectively. The props
412+
accept either a string or array of strings.
410413

411414
## Lazy loading
412415
Modal will always render its HTML markup in the document at the location that

src/components/modal/_modal.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,10 @@ export default {
267267
type: String,
268268
default: null
269269
},
270+
headerClass: {
271+
type: [String, Array],
272+
default: null
273+
},
270274
bodyBgVariant: {
271275
type: String,
272276
default: null
@@ -275,6 +279,10 @@ export default {
275279
type: String,
276280
default: null
277281
},
282+
bodyClass: {
283+
type: [String, Array],
284+
default: null
285+
},
278286
footerBgVariant: {
279287
type: String,
280288
default: null
@@ -287,6 +295,10 @@ export default {
287295
type: String,
288296
default: null
289297
},
298+
footerClass: {
299+
type: [String, Array],
300+
default: null
301+
},
290302
hideHeader: {
291303
type: Boolean,
292304
default: false
@@ -387,7 +399,8 @@ export default {
387399
[`bg-${this.headerBgVariant}`]: Boolean(this.headerBgVariant),
388400
[`text-${this.headerTextVariant}`]: Boolean(this.headerTextVariant),
389401
[`border-${this.headerBorderVariant}`]: Boolean(this.headerBorderVariant)
390-
}
402+
},
403+
this.headerClass
391404
]
392405
},
393406
bodyClasses () {
@@ -396,7 +409,8 @@ export default {
396409
{
397410
[`bg-${this.bodyBgVariant}`]: Boolean(this.bodyBgVariant),
398411
[`text-${this.bodyTextVariant}`]: Boolean(this.bodyTextVariant)
399-
}
412+
},
413+
this.bodyClass
400414
]
401415
},
402416
footerClasses () {
@@ -406,7 +420,8 @@ export default {
406420
[`bg-${this.footerBgVariant}`]: Boolean(this.footerBgVariant),
407421
[`text-${this.footerTextVariant}`]: Boolean(this.footerTextVariant),
408422
[`border-${this.footerBorderVariant}`]: Boolean(this.footerBorderVariant)
409-
}
423+
},
424+
this.footerClass
410425
]
411426
}
412427
},

0 commit comments

Comments
 (0)