Skip to content

armgit / vaul

Public Imported from GitHub
0

A drawer component for React.

fix: dismissible prop (#418)

Emil Kowalski192a30e1eaab
diff --git a/README.md b/README.md
index 4557b64..5609976 100644
--- a/README.md
+++ b/README.md
@@ -72,6 +72,8 @@ Additional props:
`defaultOpen`: Opened by default, still reacts to `open` state changes.
+`dismissible`: When `false` dragging, clicking outside, pressing esc, etc. will not close the drawer. Use this in comination with the `open` prop, otherwise you won't be able to open/close the drawer.
+
`snapToSequentialPoint`: Disabled velocity based swiping for snap points. This means that a snap point won't be skipped even if the velocity is high enough. Useful if each snap point in a drawer is equally important.
`[data-vaul-no-drag]`: When interacting with an element with this data attribute, the drawer won't be dragged.
diff --git a/src/index.tsx b/src/index.tsx
index 9bc2dd9..565b051 100644
--- a/src/index.tsx
+++ b/src/index.tsx
@@ -603,6 +603,7 @@ export function Root({
defaultOpen={defaultOpen}
modal={modal}
onOpenChange={(open) => {
+ if (!dismissible) return;
if (open) {
setHasBeenOpened(true);
} else {