Skip to content

Commit

Permalink
make uimenu accept maxWidth to avoid text truncation
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-sagi125 committed Dec 9, 2024
1 parent 20f9350 commit 56e5b4e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/KDropdownMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
ref="menu"
:options="options"
:hasIcons="hasIcons"
:maxWidth="maxWidth"
@select="handleSelection"
/>
</UiPopover>
Expand Down Expand Up @@ -82,6 +83,12 @@
type: Boolean,
default: false,
},
/** maximim width of the dropdown menu */
maxWidth: {
type: [Number, String],
default: null,
},
/**
* The position of the dropdown relative to the button
*/
Expand Down
14 changes: 14 additions & 0 deletions lib/keen/UiMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
lazy

:class="classes"
:style="menuStyle"
>
<UiMenuOption
v-for="(option, index) in options"
Expand Down Expand Up @@ -55,6 +56,10 @@
return [];
},
},
maxWidth: {
type: [Number,String],
default: null,
},
hasIcons: {
type: Boolean,
default: false,
Expand Down Expand Up @@ -101,6 +106,15 @@
'has-secondary-text': this.hasSecondaryText,
};
},
menuStyle(){
if(this.maxWidth){
return {
maxWidth: `${this.maxWidth}${typeof this.maxWidth === 'number' ? 'px' : ''}`
};
}
return{};
},
activeOutline() {
return this.isActive ? this.$coreOutline : {};
},
Expand Down

0 comments on commit 56e5b4e

Please sign in to comment.