base-ui-svelte

Drawer

A panel that slides in from the edge of the screen.

View as Markdown

Sides

API Reference

Props mirror Base UI React where applicable, adapted for Svelte 5. Native HTML attributes for the rendered element are also accepted unless noted.

Drawer.Root

Extends div HTML attributes.

PropertyTypeDefaultDescription
openboolean | undefinedWhether the component is open (controlled).
defaultOpenbooleanWhether the component is initially open (uncontrolled).
onOpenChange((open: boolean, eventDetails: { reason: OpenChangeReason }) => void) | undefinedEvent handler called when the open state changes.
swipeDirectionDrawerSwipeDirection
modalboolean
disablePointerDismissalboolean
snapPointsReadonlyArray<DrawerSnapPoint>
childrenSnippet<[{ open: boolean }]>Content rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.
data-swipe-directionDirection of an active toast swipe.
data-swipingPresent on the element when applicable.

Drawer.Provider

PropertyTypeDefaultDescription
swipeDirectionDrawerSwipeDirection
childrenSnippetContent rendered inside the part.

Drawer.Backdrop

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.

Drawer.Close

Extends button HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.

Drawer.Content

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-openPresent when the part is open.

Drawer.Description

Extends paragraph HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Drawer.Indent

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-activePresent when the item is active.
data-inactivePresent on the element when applicable.
data-swipe-directionDirection of an active toast swipe.

Drawer.IndentBackground

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-activePresent when the item is active.
data-inactivePresent on the element when applicable.
data-swipe-directionDirection of an active toast swipe.

Drawer.Popup

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.
data-swipe-directionDirection of an active toast swipe.
data-swipe-snapPresent on the element when applicable.
data-swipingPresent on the element when applicable.

Drawer.Portal

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Drawer.SwipeArea

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
disabledbooleanfalseWhether the control ignores user interaction.
swipeDirectionDrawerSwipeDirection
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.
data-swipe-directionDirection of an active toast swipe.
data-swipingPresent on the element when applicable.

Drawer.Title

Extends heading HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.

Drawer.Trigger

Extends button HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
disabledbooleanfalseWhether the control ignores user interaction.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-disabledPresent when the part is disabled.
data-openPresent when the part is open.

Drawer.Viewport

Extends div HTML attributes.

PropertyTypeDefaultDescription
renderstringHTML element tag to render instead of the default host element.
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-closedPresent when the part is closed.
data-ending-stylePresent while the exit animation can run.
data-keyboard-openPresent on the element when applicable.
data-openPresent when the part is open.
data-starting-stylePresent while the enter animation can run.
data-swipe-directionDirection of an active toast swipe.

Drawer.VirtualKeyboardProvider

Extends div HTML attributes.

PropertyTypeDefaultDescription
childrenSnippetContent rendered inside the part.
Data attributeDescription
data-keyboard-openPresent on the element when applicable.