Skip to content

Drawer

Props, sides, tiers, scopes, hooks and helpers of the shared drawer.

  • Packages
  • ab-nextjs-components
  • Client Component
  • Stable

These tables are the shared drawer contract from ab-nextjs-components/ab-drawer: props, sides, tiers, scopes, the hooks, and the gesture helpers. They are not every drawer in the package. Product drawers (navigation, outline, search, settings) are separate components and are listed under Not on this page.

AbDrawerProps

ab-nextjs-components/ab-drawer

AbDrawerProps
NameTypeDefaultDescription
openRequiredbooleanNo default🚪 controlled
onCloseRequired() => voidNo default⎋ Escape, scrim click and the close button call it
scopeAbDrawerScope | undefined'app'🗺️ which box clips it (default app)
sideAbDrawerSide | undefined'bottom'🧭 default bottom
titleReactNodeNo default🏷️ a string becomes the <h2> that labels the dialog
'aria-labelledby'string | undefinedNo default♿ your own visible title id (wins over title)
'aria-label'string | undefinedNo default♿ when there is no visible title
idstring | undefinedNo default🆔 the dialog id (aria-controls target)
childrenReactNodeNo default📄 the body (it scrolls on its own)
footerReactNodeNo default🔚 actions row (stays put)
sizestring | undefinedNo default📏 width (start/end/left/right) or height (top/bottom), e.g. 360px
modalboolean | undefinedtrue🔒 trap focus + make the rest of the scope inert (default true)
closeLabelstring | undefined'Close'🌍 default "Close"
noJsFallbackboolean | undefinedtrue🧩 D41: without JS, render the content in flow (default true)
initialFocus"first" | "panel" | (string & {}) | undefined'first'🎯 on open: the first control (default), the panel itself, or (0.2.0) a CSS selector inside the panel, e.g. [role=radio][aria-checked=true]
tierAbDrawerTier | undefinedNo default🥞 stacking tier: 'aside' (z 60) < 'nav' (61) < 'sheet' (62)
swipeboolean | undefinedfalse🤏 side drawers: swipe the sheet back toward its edge to close (30% of the width or ≥ 0.5px/ms)
snapPointsboolean | undefinedfalse🧲 bottom only, below 768px: snaps at 70% (S1) and full height (S2) with a handle; gestures per the spec
defaultSnapAbSheetSnap | undefined'partial'🧲 where it opens (default 'partial'; e.g. 'full' for a search sheet)
fullOnlyboolean | undefinedfalse🧲 no 70% stop: opens at full height, a gentle drag springs back, a hard one closes (search: the keyboard is up)
onSnapChange((snap: AbSheetSnap) => void) | undefinedNo default🔔
handleLabels{ expand: string; collapse: string; } | undefinedunknown♿ the handle button (default "Expand" / "Collapse")
centerIn"main" | undefinedNo default💻 bottom only, 768px and up: centred in the main pane, min(640px, main width) wide, ≤ 70% tall
returnFocusstring | undefinedunknown↩️ selector focused on close when there was no focusable opener (an edge swipe); default AB_DRAWER_RETURN_FOCUS (the header / brand logo)
closeIconReactNodeunknown✕ the close glyph (default a text ✕)
headerStartReactNodeNo default🏷️ header content that does NOT label the dialog (e.g. a logo; then use aria-label). title wins
classNamestring | undefinedNo default🏷️

AbDrawerSide

ab-nextjs-components/ab-drawer

'top' | 'bottom' | 'left' | 'right' | 'start' | 'end'

AbDrawerTier

ab-nextjs-components/ab-drawer

'aside' | 'nav' | 'sheet'

AbDrawerScope

ab-nextjs-components/ab-drawer

'app' | 'main' | 'aside'

AbSheetSnap

ab-nextjs-components/ab-drawer

'partial' | 'full'

UseAbDrawer

ab-nextjs-components/ab-drawer

UseAbDrawer
NameTypeDefaultDescription
scopeRequiredAbDrawerScopeNo default🗺️
idRequiredstringNo default🆔 the drawer id (aria-controls target)
openRequiredbooleanNo default🚪 is it open?
showRequired() => voidNo default➕ open it
closeRequired() => voidNo default➖ close it (Escape / scrim / buttons)
toggleRequired() => voidNo default🔁
setOpenRequired(open: boolean) => voidNo default🎚️ controlled setter
triggerPropsRequired{ 'aria-expanded': boolean; 'aria-controls': string; 'aria-haspopup': "dialog"; onClick: () => void; }No default🔘 spread on the trigger button: aria-expanded / aria-controls / aria-haspopup / onClick
drawerPropsRequired{ id: string; scope: AbDrawerScope; open: boolean; onClose: () => void; }No default🗄️ spread on the drawer: id / scope / open / onClose

useAbDrawer

ab-nextjs-components/ab-drawer

useAbDrawer(scope: AbDrawerScope = 'app', options: { defaultOpen?: boolean; id?: string } = {}): UseAbDrawer
useAbDrawer
NameTypeDefaultDescription
scopeAbDrawerScope'app'
options{ defaultOpen?: boolean; id?: string }{}

UseAbEdgeSwipeOptions

ab-nextjs-components/ab-drawer

UseAbEdgeSwipeOptions
NameTypeDefaultDescription
edgeRequired"left" | "right"No default🧱 which edge the swipe starts from (left = left-to-right, opens the left drawer)
onOpenRequired() => voidNo default🚪 called when the swipe commits
enabledboolean | undefinedtrue🎚️ e.g. false while that drawer is open, or when the page has no aside (default true)
widthnumber | undefined320📏 the drawer width the 30% rule uses (default 320)
pointerTypesreadonly string[] | undefined['touch', 'pen']🖐️ default touch + pen (a mouse never edge-swipes)
maxWidthnumber | undefinedNo default

useAbEdgeSwipe

ab-nextjs-components/ab-drawer

useAbEdgeSwipe({ edge, onOpen, enabled = true, width = 320, pointerTypes = ['touch', 'pen'], maxWidth }: UseAbEdgeSwipeOptions): void
useAbEdgeSwipe
NameTypeDefaultDescription
{ edge, onOpen, enabled = true, width = 320, pointerTypes = ['touch', 'pen'], maxWidth }RequiredUseAbEdgeSwipeOptionsNo default

AB_ASIDE_DRAWER_MAX_WIDTH

ab-nextjs-components/ab-drawer

1179
1179

AB_SWIPE

ab-nextjs-components/ab-drawer

{
  ratio: 0.3, // 📏 30% of the travel / sheet / drawer width
  velocity: 0.5, // ⚡ px per ms: at or above this a release counts as a fast swipe
  edge: 24, // 🧱 edge zone width (px) for the side-drawer swipes
  standaloneInset: 16, // 📱 iOS standalone: the zone starts 16px in (the system owns the very edge)
  slop: 8, // 🫳 px of movement before a press becomes a drag (taps stay taps)
  secondSwipe: 24, // ✌️ px: after a gentle return to S1, a swipe down this long closes (the "second swipe")
}
AB_SWIPE
NameTypeDefaultDescription
ratio0.30.3📏 30% of the travel / sheet / drawer width
velocity0.50.5⚡ px per ms: at or above this a release counts as a fast swipe
edge2424🧱 edge zone width (px) for the side-drawer swipes
standaloneInset1616📱 iOS standalone: the zone starts 16px in (the system owns the very edge)
slop88🫳 px of movement before a press becomes a drag (taps stay taps)
secondSwipe2424✌️ px: after a gentle return to S1, a swipe down this long closes (the "second swipe")

AB_DRAWER_DURATION

ab-nextjs-components/ab-drawer

240
240

AB_PREVIEW_SCOPE_SELECTOR

ab-nextjs-components/ab-drawer

"[data-ab-preview-scope]"
'[data-ab-preview-scope]'

AB_DRAWER_RETURN_FOCUS

ab-nextjs-components/ab-drawer

"[data-ab-part=\"mobile-header\"] a[href], [data-ab-part=\"app-bar-brand\"] a[href], [data-ab-part=\"sidebar-logo\"] a[href]"
'[data-ab-part="mobile-header"] a[href], [data-ab-part="app-bar-brand"] a[href], [data-ab-part="sidebar-logo"] a[href]'

getAbDrawerHost

ab-nextjs-components/ab-drawer

getAbDrawerHost(scope: AbDrawerScope, from?: Element | null): HTMLElement
getAbDrawerHost
NameTypeDefaultDescription
scopeRequiredAbDrawerScopeNo default
fromElement | nullNo default

resolveAbSheetRelease

ab-nextjs-components/ab-drawer

resolveAbSheetRelease({ from, dy, velocity, partialHeight, fullHeight, returned = false }: AbSheetReleaseInput): AbSheetRelease
resolveAbSheetRelease
NameTypeDefaultDescription
{ from, dy, velocity, partialHeight, fullHeight, returned = false }RequiredAbSheetReleaseInputNo default

resolveAbSideRelease

ab-nextjs-components/ab-drawer

resolveAbSideRelease({ distance, velocity, width }: AbSideReleaseInput): boolean
resolveAbSideRelease
NameTypeDefaultDescription
{ distance, velocity, width }RequiredAbSideReleaseInputNo default

Not on this page

  • AbBottomDrawer (ab-nextjs-components/ab-bottom-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbBottomDrawerProps (ab-nextjs-components/ab-bottom-drawer) — Product drawer props. This pass documents the shared drawer contract, not each product drawer.
  • isAbScrolledInside (ab-nextjs-components/ab-bottom-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • useAbSwipeDown (ab-nextjs-components/ab-bottom-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • UseAbSwipeDownOptions (ab-nextjs-components/ab-bottom-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbConfirmDrawer (ab-nextjs-components/ab-confirm-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbConfirmDrawerProps (ab-nextjs-components/ab-confirm-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbDrawer (ab-nextjs-components/ab-drawer) — The component value. Its props are AbDrawerProps on this page.
  • AbDrawerList (ab-nextjs-components/ab-drawer-list) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbDrawerListItem (ab-nextjs-components/ab-drawer-list) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbDrawerListProps (ab-nextjs-components/ab-drawer-list) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbDrawerScope (ab-nextjs-components/ab-drawer/use-ab-drawer) — Documented at ab-nextjs-components/ab-drawer. This path exports the same name.
  • useAbDrawer (ab-nextjs-components/ab-drawer/use-ab-drawer) — Documented at ab-nextjs-components/ab-drawer. This path exports the same name.
  • UseAbDrawer (ab-nextjs-components/ab-drawer/use-ab-drawer) — Documented at ab-nextjs-components/ab-drawer. This path exports the same name.
  • AbNavDrawer (ab-nextjs-components/ab-nav-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbNavDrawerItem (ab-nextjs-components/ab-nav-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbNavDrawerProps (ab-nextjs-components/ab-nav-drawer) — Product drawer props. This pass documents the shared drawer contract, not each product drawer.
  • AbNavDrawerSection (ab-nextjs-components/ab-nav-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AB_SEARCH_RECENT_KEY (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSearchDrawer (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSearchDrawerGroup (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSearchDrawerItem (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSearchDrawerLabels (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSearchDrawerProps (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • addAbSearchRecent (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • highlightAbSearch (ab-nextjs-components/ab-search-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSettingsDrawer (ab-nextjs-components/ab-settings-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSettingsDrawerLabels (ab-nextjs-components/ab-settings-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSettingsDrawerProps (ab-nextjs-components/ab-settings-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSettingsLocale (ab-nextjs-components/ab-settings-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbSettingsTheme (ab-nextjs-components/ab-settings-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbTocDrawer (ab-nextjs-components/ab-toc-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.
  • AbTocDrawerLink (ab-nextjs-components/ab-toc-drawer) — Product drawer link shape. This pass does not add a page for the outline drawer.
  • AbTocDrawerProps (ab-nextjs-components/ab-toc-drawer) — Product drawer export. This pass documents the shared drawer contract, not this name.

Not a public import

These names are not exported from a package entry. There is no supported import path.

  • AbSheetRelease — Declared beside resolveAbSheetRelease. ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.
  • AbSheetReleaseInput — Parameter type of resolveAbSheetRelease. ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.
  • AbSideReleaseInput — Parameter type of resolveAbSideRelease. ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.
  • isInAbEdgeZone — ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.
  • createAbVelocityTracker — ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.
  • isInAbHorizontalScroller — ab-nextjs-components/ab-drawer does not re-export it, and no exports entry points at its source file.

Settings

Theme

Language

Search