Skip to content

Commit 08298aa

Browse files
committed
feat(NcActions): add wide prop for full-width menus
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent fef17a7 commit 08298aa

2 files changed

Lines changed: 22 additions & 2 deletions

File tree

src/components/NcActions/NcActions.vue

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,14 @@ export default {
10941094
default: null,
10951095
},
10961096
1097+
/**
1098+
* Specifies whether the button should span all the available width.
1099+
*/
1100+
wide: {
1101+
type: Boolean,
1102+
default: false,
1103+
},
1104+
10971105
/**
10981106
* Specify the size used for trigger and single actions buttons.
10991107
*
@@ -1694,13 +1702,19 @@ export default {
16941702
mergeProps(
16951703
propsToForward,
16961704
{
1697-
class: 'action-item action-item--single',
1705+
class: [
1706+
'action-item action-item--single',
1707+
{
1708+
'action-item--wide': this.wide,
1709+
},
1710+
],
16981711
'aria-label': action?.props?.['aria-label'] || text,
16991712
title,
17001713
disabled: this.disabled || action?.props?.disabled,
17011714
pressed: action?.props?.modelValue,
17021715
size: this.size,
17031716
type,
1717+
wide: this.wide,
17041718
// If it has a menuName, we use a secondary button
17051719
variant: this.variant || (buttonText ? 'secondary' : 'tertiary'),
17061720
onFocus: this.onFocus,
@@ -1759,6 +1773,7 @@ export default {
17591773
disabled: this.disabled,
17601774
size: this.size,
17611775
variant: this.triggerButtonVariant,
1776+
wide: this.wide,
17621777
ref: 'triggerButton',
17631778
'aria-label': this.menuName ? null : this.ariaLabel,
17641779
// 'aria-controls' should only present together with a valid aria-haspopup
@@ -1861,6 +1876,7 @@ export default {
18611876
`action-item--${this.triggerButtonVariant}`,
18621877
{
18631878
'action-item--open': this.opened,
1879+
'action-item--wide': this.wide,
18641880
},
18651881
],
18661882
},
@@ -1913,6 +1929,10 @@ export default {
19131929
background-color: var(--open-background-color);
19141930
}
19151931
1932+
&.action-item--wide {
1933+
width: 100%;
1934+
}
1935+
19161936
&__menutoggle__icon {
19171937
width: 20px;
19181938
height: 20px;

src/components/NcButton/NcButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,7 @@ function onClick(event: MouseEvent) {
861861
}
862862
863863
// Icon-only button
864-
&:has(#{&}__text:empty) {
864+
&:has(#{&}__text:empty):not(#{&}--wide) {
865865
--button-padding: var(--button-radius);
866866
line-height: 1;
867867
width: var(--button-size) !important;

0 commit comments

Comments
 (0)