Skip to content

Commit dbafaae

Browse files
committed
more
1 parent 32d4233 commit dbafaae

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

README.md

+21-11
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ Use the drawer in your app.
4242

4343
Play around with the examples on StackBlitz:
4444

45-
- [With scaled background](https://stackblitz.com/edit/vaul-svelte-scaled?file=src%2Froutes%2F%2Bpage.svelte)
46-
- [Without scaled background](https://stackblitz.com/edit/vaul-svelte-without-scale?file=src%2Froutes%2F%2Bpage.svelte)
47-
- [With snap points](https://stackblitz.com/edit/vaul-svelte-snap-points?file=src%2Froutes%2F%2Bpage.svelte)
48-
- [Scrollable with inputs](https://stackblitz.com/edit/vaul-svelte-scrollable-with-inputs?file=src%2Froutes%2F%2Bpage.svelte)
49-
- [Nested drawers](https://stackblitz.com/edit/vaul-svelte-nested-drawers?file=src%2Froutes%2F%2Bpage.svelte)
50-
- [Non-dismissible](https://stackblitz.com/edit/vaul-svelte-non-dismissible?file=src%2Froutes%2F%2Bpage.svelte)
45+
- [With scaled background](https://stackblitz.com/edit/vaul-svelte-scaled?file=src%2Froutes%2F%2Bpage.svelte)
46+
- [Without scaled background](https://stackblitz.com/edit/vaul-svelte-without-scale?file=src%2Froutes%2F%2Bpage.svelte)
47+
- [With snap points](https://stackblitz.com/edit/vaul-svelte-snap-points?file=src%2Froutes%2F%2Bpage.svelte)
48+
- [Scrollable with inputs](https://stackblitz.com/edit/vaul-svelte-scrollable-with-inputs?file=src%2Froutes%2F%2Bpage.svelte)
49+
- [Nested drawers](https://stackblitz.com/edit/vaul-svelte-nested-drawers?file=src%2Froutes%2F%2Bpage.svelte)
50+
- [Non-dismissible](https://stackblitz.com/edit/vaul-svelte-non-dismissible?file=src%2Froutes%2F%2Bpage.svelte)
5151

5252
## API Reference
5353

@@ -60,15 +60,25 @@ Additional props:
6060

6161
`closeThreshold`: Number between 0 and 1 that determines when the drawer should be closed. Example: threshold of 0.5 would close the drawer if the user swiped for 50% of the height of the drawer or more.
6262

63-
`scrollLockTimeout`: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms
63+
`scrollLockTimeout`: Duration for which the drawer is not draggable after scrolling content inside of the drawer. Defaults to 500ms.
6464

65-
`snapPoints`: Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Example `[0.2, 0.5, 0.8]`. You can also use px values, which doesn't take screen height into account.
65+
`snapPoints`: Array of numbers from 0 to 100 that corresponds to % of the screen a given snap point should take up. Should go from least visible. Example [0.2, 0.5, 0.8]. You can also use px values, which doesn't take screen height into account.
6666

67-
`fadeFromIndex`: Index of a `snapPoint` from which the overlay fade should be applied. Defaults to the last snap point.
67+
`fadeFromIndex`: Index of a snapPoint from which the overlay fade should be applied. Defaults to the last snap point.
6868

69-
`direction`: Direction of the drawer. Can be `top`, `bottom`, `left`, or `right`. Defaults to `bottom`.
69+
`modal`: When false it allows to interact with elements outside of the drawer without closing it. Defaults to true.
7070

71-
`backgroundColor`: Background color of the body when the drawer is open and `shouldScaleBackground` is true. Defaults to black.
71+
`handleOnly`: When true only allows the drawer to be dragged by the <Drawer.Handle /> component. Defaults to false.
72+
73+
`direction`: Direction of the drawer. Can be top or bottom, left, right. Defaults to bottom.
74+
75+
`preventScrollRestoration`: When true it prevents scroll restoration when the drawer is closed after a navigation happens inside of it. Defaults to true.
76+
77+
`disablePreventScroll`: When true scroll prevention mechanism will be disabled. Scroll prevention ensures that page will not scroll on mobile when opening drawer. However this mechanism gets confused when drawer has an input with autofocus and therefore opens simulataneosly with touch keyboard. Defaults to true. modal set to false also disables it.
78+
79+
`noBodyStyles`: When true the body doesn't get any styles assigned from Vaul.
80+
81+
`setBackgroundColorOnScale`: When false we don't change body's background color when the drawer is open. true by default.
7282

7383
`[data-vaul-no-drag]`: When interacting with an element with this data attribute, the drawer won't be dragged.
7484

packages/vaul-svelte/src/lib/vaul.svelte.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -892,8 +892,7 @@ class DrawerContentState {
892892
});
893893

894894
$effect(() => {
895-
const mounted = this.mounted;
896-
if (!mounted) return;
895+
if (!this.mounted) return;
897896
this.root.visible = true;
898897
});
899898
}

0 commit comments

Comments
 (0)