Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 22 additions & 5 deletions src/components/ActionButton/ActionButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ If you're using a long text you can specify a title
<template>
<Actions>
<ActionButton icon="icon-add" @click="showMessage('Add')">
<template #icon>
<Plus :size="20" />
</template>
Add new
</ActionButton>
<ActionButton title="Long button" @click="showMessage('Delete')">
Expand All @@ -84,12 +81,10 @@ If you're using a long text you can specify a title
</template>
<script>
import Delete from 'vue-material-design-icons/Delete'
import Plus from 'vue-material-design-icons/Plus'

export default {
components: {
Delete,
Plus,
},
methods: {
showMessage(msg) {
Expand All @@ -101,6 +96,28 @@ If you're using a long text you can specify a title

```

Action icon attribute with a single action

```vue
<template>
<Actions>
<ActionButton icon="icon-add" @click="showMessage('Add')">
Add new
</ActionButton>
</Actions>
</template>
<script>
export default {
methods: {
showMessage(msg) {
alert(msg)
},
},
}
</script>

```

You can also use a custom icon, for example from the vue-material-design-icons library:

```vue
Expand Down
2 changes: 2 additions & 0 deletions src/components/Actions/Actions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -739,6 +739,8 @@ export default {
'action-item action-item--single',
firstAction?.data?.staticClass,
firstAction?.data?.class,
// use icon attribute as class if icon slot is not used
icon ? undefined : firstAction?.componentOptions?.propsData?.icon,
],
attrs: {
'aria-label': firstAction?.componentOptions?.propsData?.ariaLabel || firstAction?.componentOptions?.children?.[0]?.text,
Expand Down