Skip to content

Commit

Permalink
fix: added prop for close button label
Browse files Browse the repository at this point in the history
  • Loading branch information
kouts committed Apr 18, 2022
1 parent 50a52a0 commit cd8a0c8
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
4 changes: 4 additions & 0 deletions docs/.vuepress/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ module.exports = {
link: '/usage/',
text: 'Usage'
},
{
link: '/options/',
text: 'Options'
},
{
text: 'Examples',
collapsable: true,
Expand Down
25 changes: 20 additions & 5 deletions docs/options/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## v-model
Pass a Boolean value to the ```v-model``` directive to open and close the modal window.

Pass a Boolean value to the `v-model` directive to open and close the modal window.

## Props

<table class="table table-bordered">
<thead>
<tr>
Expand Down Expand Up @@ -95,19 +97,29 @@ Pass a Boolean value to the ```v-model``` directive to open and close the modal
<td>Opens and closes the modal window, this is used by <code>v-model</code> internally.</td>
<td>Boolean</td>
<td>false</td>
</tr>
</tr>
<tr>
<td>closeLabel</td>
<td>The aria-label attribute of the close button</td>
<td>String</td>
<td><em>Close</em></td>
</tr>
</tbody>
</table>

## Slots

### default

The default slot to use for the content of the modal.

### titlebar

The slot to use for overriding the titlebar of the modal

Default value:
``` vue

```vue
<div class="vm-titlebar">
<h3 class="vm-title">
{{ title }}
Expand All @@ -122,16 +134,19 @@ Default value:
```

### content

The slot to use for overriding the content of the modal

Default value:
``` vue

```vue
<div class="vm-content">
<slot></slot>
</div>
```

## Events

<table class="table table-bordered">
<thead>
<tr>
Expand Down Expand Up @@ -169,4 +184,4 @@ Default value:
<td>Event that fires when the modal closing transition is finished</td>
</tr>
</tbody>
</table>
</table>
12 changes: 11 additions & 1 deletion src/Modal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@
<h3 :id="`${id}-title`" class="vm-title">
{{ title }}
</h3>
<button v-if="enableClose" type="button" class="vm-btn-close" aria-label="Close" @click.prevent="close"></button>
<button
v-if="enableClose"
type="button"
class="vm-btn-close"
:aria-label="closeLabel"
@click.prevent="close"
></button>
</div>
</slot>
<slot name="content">
Expand Down Expand Up @@ -100,6 +106,10 @@ export default {
modelValue: {
type: Boolean,
default: false
},
closeLabel: {
type: String,
default: 'Close'
}
},
emits: ['before-open', 'opening', 'after-open', 'before-close', 'closing', 'after-close', 'update:modelValue'],
Expand Down

0 comments on commit cd8a0c8

Please sign in to comment.