diff --git a/apps/storybook/stories/Drawer.stories.tsx b/apps/storybook/stories/Drawer.stories.tsx index 2020a72e56c..48dfaa61df6 100644 --- a/apps/storybook/stories/Drawer.stories.tsx +++ b/apps/storybook/stories/Drawer.stories.tsx @@ -1,7 +1,7 @@ // Copyright (c) Meta Platforms, Inc. and affiliates. import type {Meta, StoryObj} from '@storybook/react'; -import {useState} from 'react'; +import {useRef, useState} from 'react'; import {Drawer} from '@astryxdesign/lab'; import {Button} from '@astryxdesign/core/Button'; import {CheckboxInput} from '@astryxdesign/core/CheckboxInput'; @@ -149,6 +149,82 @@ export const RowInspector: Story = { }, }; +/** + * `containerRef` binds the drawer to an element instead of the viewport: the + * panel slides against the pane's edge, at the pane's height, and its scrim + * dims only that pane. The rest of the page stays live — the browser top + * layer is always viewport-sized, so containment and modality cannot both be + * had. Give the container `position: relative`. + */ +export const Bounded: Story = { + render: () => { + const paneRef = useRef(null); + const [selectedId, setSelectedId] = useState(null); + const selected = HOSTS.find(host => host.id === selectedId); + return ( + + + The drawer is bound to the bordered pane. Everything outside it stays + interactive while the drawer is open. + +
+
+ + Hosts + {HOSTS.map(host => ( +
+
+