Skip to content
HooksPro

useAppLayout

Opens the navigation drawer and the side panel of the surrounding AppLayout.

Returns the controls of the nearest : opens the sidebar as a drawer on small screens, shows or hides the right-hand panel, and says whether that panel is on screen right now.

See alsoApp Layout

Import

tsx
import { useAppLayout } from "@wunderui/react"

Comes with WunderUI Core and Pro, in the package from your plan. See the plans.

Signature

ts
useAppLayout(): AppLayoutState | null

Returns

Examples

Open the details panel from a row

tsx
import { Button, useAppLayout } from "@wunderui/react"

export function ShowDetails() {
  const layout = useAppLayout()
  return (
    <Button variant="plain" size="sm" onClick={() => layout?.setAsideOpen(true)} disabled={!layout}>
      Details
    </Button>
  )
}

Notes

  • Returns outside an , so check the result before you call it.
  • Use it for buttons inside the page, such as a details button in a table row that opens the aside.
  • is a function, not a value: it measures at the moment you ask, below the drawer breakpoint too.