11---
22title : AnchoredOverlay
33status : Alpha
4+ source : https://github.com/primer/react/blob/main/src/AnchoredOverlay/AnchoredOverlay.tsx
5+ storybook : https://primer.style/react/storybook?path=/story/generic-behaviors-anchoredoverlay--default-portal
46---
57
68An ` AnchoredOverlay ` provides an anchor that will open a floating overlay positioned relative to the anchor.
79The overlay can be opened and navigated using keyboard or mouse.
810
911See also [ Overlay positioning] ( /Overlay#positioning ) .
1012
11- ## Example
13+ ## Examples
1214
1315``` jsx live
1416< State default= {false }>
@@ -35,3 +37,121 @@ See also [Overlay positioning](/Overlay#positioning).
3537 }}
3638< / State>
3739```
40+
41+ ## Props
42+
43+ <PropsTable >
44+ <PropsTableRow
45+ name = " open"
46+ type = " boolean"
47+ defaultValue = " false"
48+ description = " Determines whether the overlay portion of the component should be shown or not."
49+ />
50+ <PropsTableRow
51+ name = " onOpen"
52+ type = " (gesture: 'anchor-click' | 'anchor-key-press') => unknown"
53+ description = ' A callback that is called whenever the overlay is currently closed and an "open gesture" is detected.'
54+ />
55+ <PropsTableRow
56+ name = " onClose"
57+ type = " (gesture: 'anchor-click' | 'click-outside' | 'escape') => unknown"
58+ description = ' A callback that is called whenever the overlay is currently open and a "close gesture" is detected.'
59+ />
60+ <PropsTableRow
61+ name = " renderAnchor"
62+ type = " <T extends React.HTMLAttributes<HTMLElement>>(props: T) => JSX.Element"
63+ description = {
64+ <>
65+ A custom function component used to render the anchor element. When renderAnchor is null, an anchorRef is
66+ required.
67+ </>
68+ }
69+ />
70+ <PropsTableRow
71+ name = " anchorRef"
72+ type = " React.RefObject<HTMLElement>"
73+ description = {
74+ <>
75+ An override to the internal <InlineCode >renderAnchor</InlineCode > ref that will be used to position the overlay.
76+ When <InlineCode >renderAnchor</InlineCode > is
77+ <InlineCode >null</InlineCode >, this can be used to make an anchor that is detached from <InlineCode >
78+ AnchoredOverlay
79+ </InlineCode >.
80+ </>
81+ }
82+ />
83+ <PropsTableRow
84+ name = " side"
85+ type = { ` | 'inside-top'
86+ | 'inside-bottom'
87+ | 'inside-left'
88+ | 'inside-right'
89+ | 'inside-center'
90+ | 'outside-top'
91+ | 'outside-bottom'
92+ | 'outside-left'
93+ | 'outside-right' ` }
94+ defaultValue = " 'outside-bottom'"
95+ />
96+ <PropsTableRow name = " align" type = " 'start' | 'center' | 'end'" defaultValue = " 'start'" />
97+ <PropsTableRow
98+ name = " overlayProps"
99+ type = {
100+ <>
101+ Partial< <Link href = " /Overlay#props" >OverlayProps</Link >>
102+ </>
103+ }
104+ description = {
105+ <>
106+ Props to be spread on the internal <InlineCode >Overlay</InlineCode > component.
107+ </>
108+ }
109+ />
110+ <PropsTableRow
111+ name = " focusTrapSettings"
112+ type = {
113+ <>
114+ Partial< <Link href = " /focusTrap#focustraphooksettings-interface" >FocusTrapHookSettings</Link >>
115+ </>
116+ }
117+ description = {
118+ <>
119+ Settings to apply to the focus trap on the internal <InlineCode >Overlay</InlineCode > component.
120+ </>
121+ }
122+ />
123+ <PropsTableRow
124+ name = " focusZoneSettings"
125+ type = {
126+ <>
127+ Partial< <Link href = " /focusZone#focuszonehooksettings-interface" >FocusZoneHookSettings</Link >>
128+ </>
129+ }
130+ description = {
131+ <>
132+ Settings to apply to the focus zone on the internal <InlineCode >Overlay</InlineCode > component.
133+ </>
134+ }
135+ />
136+ </PropsTable >
137+
138+ ## Status
139+
140+ <ComponentChecklist
141+ items = { {
142+ propsDocumented: true ,
143+ noUnnecessaryDeps: true ,
144+ adaptsToThemes: true ,
145+ adaptsToScreenSizes: true ,
146+ fullTestCoverage: false ,
147+ usedInProduction: true ,
148+ usageExamplesDocumented: false ,
149+ hasStorybookStories: true ,
150+ designReviewed: false ,
151+ a11yReviewed: false ,
152+ stableApi: false ,
153+ addressedApiFeedback: false ,
154+ hasDesignGuidelines: false ,
155+ hasFigmaComponent: false
156+ }}
157+ />
0 commit comments