Skip to content

Commit 36acf4e

Browse files
zagtotmorehouse
authored andcommitted
feat(modal): Add props to change the variant of the default modal buttons (bootstrap-vue#1004)
* Add props to set variant of modal footer buttons * update docs
1 parent 56a4e5e commit 36acf4e

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

docs/components/modal/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ They support a number of use cases from user notification to completely custom c
6161

6262
`<b-modal>`, by default, has an **OK** and a **Close** button in the footer. These buttons can
6363
be customized by setting various props on the component. You can customize the size of the buttons,
64-
disable the **OK** button, hide the **Close** button (i.e. OK Only), and provide custom
64+
disable the **OK** button, hide the **Close** button (i.e. OK Only), choose a variant (e.g. `danger`
65+
for a red OK button) using the `ok-variant` and `close-variant` props, and provide custom
6566
button content using the `ok-title` and `close-title` props, or using the named
6667
slots `modal-ok` and `modal-cancel`.
6768

lib/components/modal.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,11 @@
5555
<footer class="modal-footer" ref="footer" v-if="!hideFooter">
5656
<slot name="modal-footer">
5757
<b-btn v-if="!okOnly"
58-
variant="secondary"
58+
:variant="closeVariant"
5959
:size="buttonSize"
6060
@click="hide(false)"
6161
><slot name="modal-cancel">{{ closeTitle }}</slot></b-btn>
62-
<b-btn variant="primary"
62+
<b-btn :variant="okVariant"
6363
:size="buttonSize"
6464
:disabled="okDisabled"
6565
@click="hide(true)"
@@ -239,6 +239,14 @@
239239
okTitle: {
240240
type: String,
241241
default: 'OK'
242+
},
243+
closeVariant: {
244+
type: String,
245+
default: 'secondary'
246+
},
247+
okVariant: {
248+
type: String,
249+
default: 'primary'
242250
}
243251
},
244252
methods: {

0 commit comments

Comments
 (0)