Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
b98d812
feat: css transition support
huntabyte Mar 7, 2026
d435ed3
docs
huntabyte Mar 7, 2026
162f3b7
fix: tests
huntabyte Mar 8, 2026
77ce119
feat: drawer
huntabyte Apr 2, 2026
af29093
Merge branch 'feat/css-transition-support' into feat/drawer
huntabyte Apr 2, 2026
b164209
changeset
huntabyte Apr 2, 2026
58f9c3f
lint checks
huntabyte Apr 2, 2026
1019a38
export drawer demos
huntabyte Apr 2, 2026
14d4fc2
Merge branch 'main' into feat/drawer
huntabyte Apr 10, 2026
952497f
fix(drawer): touch outside taps, backdrop/close, and swipe interaction
huntabyte Apr 10, 2026
2a8bfe3
fix drawer tests
huntabyte Apr 12, 2026
4f01025
fix(drawer): add destroyed state to prevent interactions after destru…
huntabyte Apr 13, 2026
cd38ac3
fix(drawer): open/disabled state for swipe and pointer handlers
huntabyte Apr 14, 2026
e17d749
fix(drawer): remove document touchmove listeners when closed
huntabyte Apr 14, 2026
e1f5031
Merge branch 'main' into feat/drawer
huntabyte Apr 17, 2026
c7a4e81
Merge upstream main into Drawer continuation
maxffarrell Nov 6, 2026
d7c0052
Verify Drawer behavior and document migration from vaul-svelte
maxffarrell Nov 6, 2026
d5567f4
Fix Drawer docs import for SvelteKit 3
maxffarrell Nov 6, 2026
f53e5d6
feat(drawer): add Base UI state and lifecycle contracts
maxffarrell Nov 15, 2026
e038af4
docs(drawer): complete API type definitions and reference details
maxffarrell Nov 15, 2026
4f41da2
Merge remote-tracking branch 'upstream/main' into action/drawer
maxffarrell Nov 15, 2026
ed22efd
Merge remote-tracking branch 'upstream/main' into HEAD
maxffarrell Nov 28, 2026
48cbbb3
Clarify Drawer preview stability and verify SSR IDs
maxffarrell Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions .agents/skills/migrate-vaul-svelte/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
name: migrate-vaul-svelte
description: Migrate Svelte apps and wrapper components from vaul-svelte to the Bits UI Drawer preview. Use when replacing vaul-svelte imports, shadcn-svelte drawers backed by vaul-svelte, or Vaul drawer props and styles.
---

# Migrate vaul-svelte drawers

Check that the target Bits UI package exports `unstable_Drawer` and that the app runs Svelte 5. For this preview, import it as `import { unstable_Drawer as Drawer } from "bits-ui"`. Check the installed declarations if migrating to a later release. Find imports, wrappers, forwarded props, `data-vaul-*` selectors, and Vaul CSS variables. Migrate the shared wrapper first when it owns the drawer structure.

Use this component hierarchy:

```svelte
<script lang="ts">
import { unstable_Drawer as Drawer } from "bits-ui";
</script>

<Drawer.Root>
<Drawer.Trigger>Open settings</Drawer.Trigger>
<Drawer.Portal>
<Drawer.Backdrop />
<Drawer.Viewport>
<Drawer.Popup>
<Drawer.Content>
<Drawer.Title>Settings</Drawer.Title>
<Drawer.Description>Adjust your preferences.</Drawer.Description>
<Drawer.Close>Close</Drawer.Close>
</Drawer.Content>
</Drawer.Popup>
</Drawer.Viewport>
</Drawer.Portal>
</Drawer.Root>
```

This illustrates structure. Port positioning and motion using the [Drawer docs](../../../docs/content/components/drawer.md) and [demos](../../../docs/src/lib/components/demos). For example, use a fixed viewport to position a bottom sheet, then style its popup using `--drawer-swipe-movement-y`, `data-starting-style`, and `data-ending-style`. For a snap drawer include `--drawer-snap-point-offset` in the transform. Keep focus, sizing, and surface styling on the popup and inner layout on content.

| Vaul | Bits UI Drawer |
| -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `Overlay` | `Backdrop` |
| `NestedRoot` or `nested` | A regular `Root` inside the parent Drawer tree |
| `direction` | `swipeDirection`: `bottom → down`, `top → up`, `left → left`, `right → right` |
| `activeSnapPoint`, `onActiveSnapPointChange` | `snapPoint`, `onSnapPointChange` |
| `snapToSequentialPoint` | `snapToSequentialPoints` |
| `onAnimationEnd` | `onOpenChangeComplete` for open and close completion |
| `container` | `Portal to={target}` |
| `shouldScaleBackground`, wrapper marker and body color styling | `Provider`, `Indent`, and `IndentBackground` with app-owned CSS |
| Focus and outside-interaction options | Configure `onOpenAutoFocus`, `onCloseAutoFocus`, `onInteractOutside`, and `onEscapeKeydown` on `Popup` |

Keep `bind:open` and `onOpenChange`. State callbacks now receive cancelable details (`reason`, `event`, `trigger`, `cancel()`). Root exposes `disablePointerDismissal` and bindable `actions` with `close()` / `unmount()`; use `preventUnmountOnClose()` from the open-change details to defer closing until explicit unmount. The styled swipe grip remains a wrapper concern; do not treat `tether` as a visual handle. For vertical snap points, use viewport fractions from 0 to 1, pixel numbers above 1, or `px` / `rem` strings. Initialize the bound snap value if the old drawer opened at a specific point. For non-modal drawers, set `modal={false}` on Root and omit the backdrop when appropriate. Use `modal="trap-focus"` to retain the focus trap without locking page scroll. Popup focus and scroll overrides remain available.

Replace `data-vaul-no-drag` with `data-bits-ui-swipe-ignore` on the region where a drag should never start.

Review `Handle` / `handleOnly`, `dismissible`, `closeThreshold`, `scrollLockTimeout`, `fadeFromIndex`, `onDrag`, and `onRelease` explicitly. They have no direct mapping in this preview. For example, escape and outside interaction can be ignored individually, but that still leaves swipe dismissal enabled. Preserve behavior that the app depends on by flagging it for a decision before switching those call sites. For keyboard repositioning, opt in with `Drawer.VirtualKeyboardProvider`, use the viewport's `--drawer-keyboard-inset`, and test real iOS Safari if available.

Verify the migrated wrapper's open and close paths, accessible name and restoration of the previously focused element, swipe direction and snap behavior, nested dismissal, and any forms or scrollable inputs. Remove the vaul-svelte dependency only after checking all app and test entry points for remaining imports.
5 changes: 5 additions & 0 deletions .changeset/eager-buttons-prove.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"bits-ui": minor
---

Add Drawer as a preview component. Import it as `unstable_Drawer`; the API may change before stabilization.
Loading
Loading