Skip to content

Commit

Permalink
feat: expose maxHeight prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Ernest committed Jun 5, 2021
1 parent 1b4de97 commit 5e9bf83
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,18 @@

Whether to collapse dropdown after selected/removed.

### maxHeight

New in `v2.5.0+`

- **Type**: `number`

- **Default**: `300`

- **Details**:

Max height of dropdown.

## Events

### update:modelValue
Expand Down
4 changes: 4 additions & 0 deletions src/components/dropdown.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<template>
<ul
class="vue-dropdown"
:style="{ maxHeight: maxHeight + 'px' }"
@mousedown.prevent
v-bind="dataAttrs"
role="listbox"
Expand Down Expand Up @@ -53,6 +54,9 @@ export default {
required: true,
type: Number,
},
maxHeight: {
required: true,
},
},
emits: ['click-item', 'mousemove'],
setup(props, context) {
Expand Down
1 change: 0 additions & 1 deletion src/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ input[readonly] {
position: relative;
background-color: white;
z-index: 1;
max-height: 300px;
overflow-y: auto;
width: 100%;
min-width: 0;
Expand Down
5 changes: 5 additions & 0 deletions src/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
@click-item="addOrRemoveOption"
@mousemove="(ev, option) => pointerSet(option.originalIndex)"
:comboboxUid="instance.uid"
:maxHeight="maxHeight"
>
<template #default="{ option }">
<slot name="dropdown-item" :option="option.originalOption">
Expand Down Expand Up @@ -253,6 +254,10 @@ const VueSelect = {
default: false,
type: Boolean,
},
maxHeight: {
default: 300,
type: Number,
},
},
emits: [
'selected',
Expand Down

0 comments on commit 5e9bf83

Please sign in to comment.