Skip to content

Commit 2b372bb

Browse files
committed
Add containerClasses prop to Popover
1 parent e9ef507 commit 2b372bb

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

src/components/feedback/Popover.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,17 @@ function useOnClose(
260260

261261
export type PopoverProps = {
262262
children?: ComponentChildren;
263-
classes?: string | string[];
264263
variant?: 'panel' | 'custom';
265264

265+
/**
266+
* Additional classes to be passed to the first child element of the popover,
267+
* the one directly wrapping `children`.
268+
*/
269+
classes?: string | string[];
270+
271+
/** Additional classes to be passed to the outermost element */
272+
containerClasses?: string | string[];
273+
266274
/** Ref for the popover element. */
267275
elementRef?: RefObject<HTMLElement>;
268276

@@ -386,6 +394,7 @@ export default function Popover({
386394
placement = 'below',
387395
arrow = false,
388396
classes,
397+
containerClasses,
389398
variant = 'panel',
390399
onScroll,
391400
elementRef,
@@ -429,6 +438,7 @@ export default function Popover({
429438
'right-0': align === 'right',
430439
'min-w-full': true,
431440
},
441+
containerClasses,
432442
)}
433443
ref={downcastRef(popoverRef)}
434444
popover={asNativePopover && 'auto'}

src/pattern-library/components/patterns/feedback/PopoverPage.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,22 @@ export default function PopoverPage() {
136136
<Library.SectionL3 title="classes">
137137
<Library.Info>
138138
<Library.InfoItem label="description">
139-
Additional CSS classes to pass to the popover.
139+
Additional CSS classes to pass to the popover{"'"}s first child,
140+
the one directly wrapping `children`.
141+
</Library.InfoItem>
142+
<Library.InfoItem label="type">
143+
<code>string | string[]</code>
144+
</Library.InfoItem>
145+
<Library.InfoItem label="default">
146+
<code>undefined</code>
147+
</Library.InfoItem>
148+
</Library.Info>
149+
</Library.SectionL3>
150+
<Library.SectionL3 title="containerClasses">
151+
<Library.Info>
152+
<Library.InfoItem label="description">
153+
Additional CSS classes to pass to the popover{"'"}s outermost
154+
element.
140155
</Library.InfoItem>
141156
<Library.InfoItem label="type">
142157
<code>string | string[]</code>

0 commit comments

Comments
 (0)