Skip to content

Commit

Permalink
add <slot name="after-input">
Browse files Browse the repository at this point in the history
  • Loading branch information
janosh committed Jun 24, 2023
1 parent 355eee9 commit 0fe8e8d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@
"update-coverage": "vitest tests/unit --run --coverage && npx istanbul-badges-readme"
},
"dependencies": {
"svelte": "^4.0.0-next.1"
"svelte": "^4.0.0"
},
"devDependencies": {
"@iconify/svelte": "^3.1.4",
"@playwright/test": "^1.35.1",
"@sveltejs/adapter-static": "^2.0.2",
"@sveltejs/kit": "^1.20.4",
"@sveltejs/package": "2.0.2",
"@sveltejs/vite-plugin-svelte": "2.4.1",
"@typescript-eslint/eslint-plugin": "^5.59.11",
"@typescript-eslint/parser": "^5.59.11",
"@sveltejs/kit": "^1.20.5",
"@sveltejs/package": "2.1.0",
"@sveltejs/vite-plugin-svelte": "2.4.2",
"@typescript-eslint/eslint-plugin": "^5.60.0",
"@typescript-eslint/parser": "^5.60.0",
"@vitest/coverage-v8": "^0.32.2",
"eslint": "^8.43.0",
"eslint-plugin-svelte3": "^4.0.0",
Expand All @@ -46,11 +46,11 @@
"prettier-plugin-svelte": "^2.10.1",
"rehype-autolink-headings": "^6.1.1",
"rehype-slug": "^5.1.0",
"svelte-check": "^3.4.3",
"svelte-check": "^3.4.4",
"svelte-preprocess": "^5.0.4",
"svelte-toc": "^0.5.5",
"svelte-zoo": "^0.4.7",
"svelte2tsx": "^0.6.15",
"svelte-zoo": "^0.4.8",
"svelte2tsx": "^0.6.16",
"typescript": "5.1.3",
"vite": "^4.3.9",
"vitest": "^0.32.2"
Expand Down
5 changes: 3 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![Tests](https://github.com/janosh/svelte-multiselect/actions/workflows/test.yml/badge.svg)](https://github.com/janosh/svelte-multiselect/actions/workflows/test.yml)
[![GitHub Pages](https://github.com/janosh/svelte-multiselect/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/janosh/svelte-multiselect/actions/workflows/gh-pages.yml)
[![NPM version](https://img.shields.io/npm/v/svelte-multiselect?logo=NPM&color=purple)](https://npmjs.com/package/svelte-multiselect)
[![Needs Svelte version](https://img.shields.io/npm/dependency-version/svelte-multiselect/svelte?color=teal&logo=Svelte&label=Svelte)](https://github.com/sveltejs/svelte/blob/master/CHANGELOG.md)
[![Needs Svelte version](https://img.shields.io/npm/dependency-version/svelte-multiselect/svelte?color=teal&logo=Svelte&label=Svelte)](https://github.com/sveltejs/svelte/blob/master/packages/svelte/CHANGELOG.md)
[![REPL](https://img.shields.io/badge/Svelte-REPL-blue?label=Try%20it!)](https://svelte.dev/repl/a5a14b8f15d64cb083b567292480db05)
[![Open in StackBlitz](https://img.shields.io/badge/Open%20in-StackBlitz-darkblue?logo=stackblitz)](https://stackblitz.com/github/janosh/svelte-multiselect)

Expand Down Expand Up @@ -394,8 +394,9 @@ Full list of props/bindable variables for this component. The `Option` type you
- `textInputIsDuplicate: boolean`: Whether user has typed text that matches an already existing option.
- `searchText: string`: The text user typed into search input.
- `msg: string`: `duplicateOptionMsg` if user input is a duplicate else `createOptionMsg`.
1. `slot='after-input'`: ForPlaced after the search input. For arbitrary content like icons or temporary messages. Receives props `selected`, `disabled`, `invalid`, `id`, `placeholder`, `open`, `required`.

Example:
Example using several slots:

```svelte
<MultiSelect options={[`Red`, `Green`, `Blue`, `Yellow`, `Purple`]} let:idx let:option>
Expand Down
10 changes: 10 additions & 0 deletions src/lib/MultiSelect.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,16 @@
on:touchstart
/>
<!-- the above on:* lines forward potentially useful DOM events -->
<slot
name="after-input"
{selected}
{disabled}
{invalid}
{id}
{placeholder}
{open}
{required}
/>
</ul>
{#if loading}
<slot name="spinner">
Expand Down

0 comments on commit 0fe8e8d

Please sign in to comment.