Skip to content

Commit f602e90

Browse files
committed
feat(slots): improve placeholder slot
1 parent 21fe3db commit f602e90

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

docs/slots.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,22 @@ Customize the rendered template for the clear icon. Please note that the slot is
138138
</template>
139139
```
140140

141+
## placeholder
142+
143+
**Type**: `slotProps: { text: string }`
144+
145+
Customize the rendered template for the placeholder.
146+
147+
```vue
148+
<template>
149+
<VueSelect v-model="option" :options="options">
150+
<template #placeholder>
151+
<span>Custom placeholder</span>
152+
</template>
153+
</VueSelect>
154+
</template>
155+
```
156+
141157
## loading
142158

143159
**Type**: `slotProps: {}`

playground/demos/CustomPlaceholder.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ref } from "vue";
44
import VueSelect from "../../src";
55
66
const selected = ref<string | null>(null);
7+
78
const options: Option<string>[] = [
89
{ label: "Alice's Adventures in Wonderland", value: "alice" },
910
{ label: "A Wizard of Earthsea", value: "wizard" },

src/types/slots.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export type Slots<GenericOption extends Option<OptionValue>, OptionValue> = {
1111
"clear"?: () => any;
1212
"dropdown"?: () => any;
1313
"loading"?: () => any;
14+
"placeholder"?: () => any;
1415
"menu-header"?: () => any;
1516
"option"?: (props: { option: GenericOption; index: number; isFocused: boolean; isSelected: boolean; isDisabled: boolean }) => any;
1617
"no-options"?: () => any;

0 commit comments

Comments
 (0)