View as Markdown

API reference: @salmonui/overlays/drawer

DrawerPropsinterface

import type { DrawerProps } from '@salmonui/overlays/drawer';
interface DrawerProps extends Omit<DialogProps, 'placement' | 'position' | 'defaultPosition' | 'onPositionChange' | 'draggable' | 'dragHandle' | 'onMoveStart' | 'onMove' | 'onMoveEnd' | 'resizable' | 'onResizeStart' | 'onResize' | 'onResizeEnd' | 'fullScreen'> {
    readonly side?: 'start' | 'end' | 'top' | 'bottom' | undefined;
    readonly size?: number | string | undefined;
}
DrawerProps members (25, 23 inherited)
NameSignatureDescription
sideoptionalreadonly side?: 'start' | 'end' | 'top' | 'bottom' | undefined;

Edge the panel slides from: logical 'start' (default) / 'end', or 'top' / 'bottom'.

sizeoptionalreadonly size?: number | string | undefined;

Inline size (start / end) or block size (top / bottom), number px or CSS length. Default 320 px.

childrenoptionalinheritedchildren?: ReactNode;

Content parts: Dialog.Title, Dialog.Description, Dialog.Body, Dialog.Footer, Dialog.Close.

triggeroptionalinheritedtrigger?: ReactNode;

Rendered before the dialog with the dialog's context: usually a Dialog.Trigger.

openoptionalinheritedopen?: boolean;
defaultOpenoptionalinheriteddefaultOpen?: boolean;
onOpenChangeoptionalinheritedonOpenChange?: ((open: boolean, event: DialogOpenChangeEvent) => void);
onAfterOpenoptionalinheritedonAfterOpen?: (() => void);
onAfterCloseoptionalinheritedonAfterClose?: (() => void);
modaloptionalinheritedmodal?: boolean;

showModal() (default) or show() (modeless: no backdrop, no focus containment).

dismissibleoptionalinheriteddismissible?: boolean | { readonly escape?: boolean | undefined; readonly outside?: boolean | undefined; };

Escape and backdrop dismissal. true = both, false = none. Default { escape: true, outside: false }.

onOverlayPressoptionalinheritedonOverlayPress?: ((event: PointerEvent) => void);

Press on the backdrop of a modal dialog.

closeButtonoptionalinheritedcloseButton?: boolean;

A close button in the corner (label localeText.close). Default false.

titleoptionalinheritedtitle?: ReactNode;

Shorthand for a Dialog.Title at the top.

initialFocusoptionalinheritedinitialFocus?: false | RefObject<HTMLElement | null>;

Element focused on open (else [data-autofocus], else the first focusable); false keeps the platform default.

returnFocusoptionalinheritedreturnFocus?: boolean;

Return focus to the invoker on close. Default true.

containeroptionalinheritedcontainer?: Element | null;

Modeless only: render the dialog inside this element (positioned in it) instead of in place. Mounted after hydration.

keepMountedoptionalinheritedkeepMounted?: boolean;

Render the closed <dialog> too (content in the server HTML).

widthoptionalinheritedwidth?: string | number;
heightoptionalinheritedheight?: string | number;
minHeightoptionalinheritedminHeight?: string | number;
localeTextoptionalinheritedlocaleText?: DialogLocaleText;
classNamesoptionalinheritedclassNames?: Partial<Record<"closeButton", string>>;
stylesoptionalinheritedstyles?: Partial<Record<"closeButton", CSSProperties>>;
refoptionalinheritedref?: Ref<HTMLDialogElement>;

The <dialog> element.