You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-15Lines changed: 17 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,11 +4,9 @@
4
4
5
5
> Great for creating dropdowns, tooltips and popovers
6
6
7
-
Svelte overlay is wrapper copmponent which makes all difficult stuff for you, but you decide when to open/close
8
-
it and how it looks.
7
+
Svelte overlay is wrapper copmponent which makes all difficult stuff for you, but you decide when to open/close it and how it looks.
9
8
10
9
## Features
11
-
- it's portaled (always visible, even if inside e.g modal with overflow: hidden)
12
10
- may be nested
13
11
- if content has not enough space on one side it will try to render on other side. For instance if position is set to `top-left` and there's no room on top position will be set to `bottom-left`. This feature listens to window resize event
14
12
- may be open/closed on every trigger and content event or from outside
@@ -66,18 +64,18 @@ To get it work component requires two slots:
66
64
67
65
**Overlay props**
68
66
69
-
| Prop name | Type |Description|Default|
67
+
| Prop name | Type |Default|Description|
70
68
| --- | --- | --- | --- |
71
-
| isOpen | Boolean |isOpen state | false|
72
-
| position | String |`top-left`<br />`top-center`<br />`top-right`<br />`bottom-left`<br />`bottom-center`<br />`bottom-right`<br />`left-top`<br />`left-center`<br />`left-bottom`<br />`right-top`<br />`right-center`<br />`right-bottom`<br /><br />Uses default position when wrong position was passed|`bottom-right`|
73
-
| zIndex | Number | value of z-index for overlay and portaled content| 1|
74
-
| class | string | global class name| ''|
75
-
| style | string | style string which will be added at the end of component style attribute| ''|
76
-
| closeOnClickOutside | Boolean | if true click outside will close overlay| false|
77
-
| closeOnScroll | Boolean | if true scrolling outside content will close overlay| false|
78
-
| updateOnScroll | Boolean | if true scrolling will update content position| false|
79
-
| onWindowKeyDown | Function | triggers when overlay is opened and user hit any button.<br/>Gets Event as first argument and object of { open, close, toggle, isOpen }||
80
-
| on:toggle| Function | Event dispatched on overlay toggle.<br/>Gets Event as first argument and object of { open, close, toggle, isOpen }||
69
+
| isOpen | Boolean |false | isOpen state|
70
+
| position | String |`bottom-right`|`top-left`<br />`top-center`<br />`top-right`<br />`bottom-left`<br />`bottom-center`<br />`bottom-right`<br />`left-top`<br />`left-center`<br />`left-bottom`<br />`right-top`<br />`right-center`<br />`right-bottom`<br /><br />Uses default position when wrong position was passed.<br/> You may import array of all positions with:<br /> ``` import { positions } from 'svelte-overlay'; ```|
71
+
| zIndex | Number |1 |value of z-index for overlay and content |
72
+
| class | string |"" |global class name |
73
+
| style | string |"" |style string which will be added at the end of component style attribute |
74
+
| closeOnClickOutside | Boolean |false |if true - click outside will close overlay |
75
+
| closeOnScroll | Boolean |false |if true - scrolling outside content will close overlay |
76
+
| updateOnScroll | Boolean |false |if true - scrolling will update content position |
77
+
| onWindowKeyDown | Function |undefined |triggers when overlay is opened and user hit any button.<br/>Gets Event as first argument and object of { open, close, toggle, isOpen } |
78
+
| on:toggle| Function |undefined |Event dispatched on overlay toggle.<br/>Gets Event as first argument and object of { open, close, toggle, isOpen } |
81
79
82
80
**slot props**
83
81
@@ -145,6 +143,7 @@ Each slot gets theese props, available through let:propName
145
143
</Overlay>
146
144
```
147
145
146
+
---
148
147
### Open/close on mouseenter/mouseleave [REPL](https://svelte.dev/repl/d04cf212c9a8406aad8932ca039634ac?version=3.22.2)
149
148
150
149
```javascript
@@ -164,6 +163,7 @@ Each slot gets theese props, available through let:propName
164
163
</Overlay>
165
164
```
166
165
166
+
---
167
167
### Open from outside [REPL](https://svelte.dev/repl/f96379b640d74556bf415ae8d74b2598?version=3.22.2)
168
168
169
169
```javascript
@@ -190,8 +190,9 @@ Each slot gets theese props, available through let:propName
190
190
</Overlay>
191
191
```
192
192
193
+
---
193
194
### With backdrop, disabled scroll and animations [REPL](https://svelte.dev/repl/cf3db92312394dd1a6efaf3374118b2c?version=3.22.2)
194
-
****
195
+
195
196
```javascript
196
197
<script>
197
198
importOverlayfrom'svelte-overlay';
@@ -249,6 +250,7 @@ Each slot gets theese props, available through let:propName
249
250
250
251
```
251
252
253
+
---
252
254
### Nested with click outside and close on esc key [REPL](https://svelte.dev/repl/284b4a09eddc4b64b5bd6734712d30ee?version=3.22.2)
0 commit comments