Skip to content

Commit 4d393e4

Browse files
committed
feat(NcActionButton): introduce 'subline' prop
Signed-off-by: Maksim Sukharev <antreesy.web@gmail.com>
1 parent 1b12ade commit 4d393e4

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/assets/action.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,15 @@
113113
display: block;
114114
}
115115

116+
&__subline {
117+
display: block;
118+
white-space: pre-wrap;
119+
font-size: var(--font-size-small);
120+
line-height: var(--default-line-height);
121+
color: var(--color-text-maxcontrast);
122+
cursor: pointer;
123+
}
124+
116125
&__menu-icon {
117126
margin-inline: auto calc($icon-margin * -1);
118127
}

src/components/NcActionButton/NcActionButton.vue

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ This component is made to be used inside of the [NcActions](#NcActions) componen
5353
</script>
5454
```
5555

56-
If you're using a long text you can specify a name
56+
If you're using a long text, you can specify a `name` prop.
57+
58+
For the same purpose, but in a more compact way, `subline` prop can be used.
5759

5860
```vue
5961
<template>
@@ -70,15 +72,23 @@ If you're using a long text you can specify a name
7072
</template>
7173
This button is associated with a very long text.\nAnd with new lines too.
7274
</NcActionButton>
75+
<NcActionButton subline="Subline description for the button" @click="showMessage('Edit')">
76+
<template #icon>
77+
<Pencil :size="20" />
78+
</template>
79+
Edit
80+
</NcActionButton>
7381
</NcActions>
7482
</template>
7583
<script>
7684
import Delete from 'vue-material-design-icons/Delete.vue'
85+
import Pencil from 'vue-material-design-icons/Pencil.vue'
7786
import Plus from 'vue-material-design-icons/Plus.vue'
7887

7988
export default {
8089
components: {
8190
Delete,
91+
Pencil,
8292
Plus,
8393
},
8494
methods: {
@@ -348,6 +358,9 @@ export default {
348358
class="action-button__text">
349359
{{ text }}
350360
</span>
361+
<span v-if="subline"
362+
class="action-button__subline"
363+
v-text="subline" />
351364
</span>
352365

353366
<!-- right(in LTR) or left(in RTL) arrow icon when there is a sub-menu -->
@@ -444,6 +457,14 @@ export default {
444457
type: String,
445458
default: null,
446459
},
460+
461+
/**
462+
* Small underlying text content of the entry
463+
*/
464+
subline: {
465+
type: String,
466+
default: '',
467+
},
447468
},
448469
449470
emits: ['update:modelValue'],

0 commit comments

Comments
 (0)