Skip to content

Commit

Permalink
feat: added support for className to <AnchoredOverlay> (#4741)
Browse files Browse the repository at this point in the history
* feat: added support for className to <AnchoredOverlay>

* feat: add support for className to <AnchoredOverlay>

* add changeset

---------

Co-authored-by: Prince Yadav <prince1.yadav@tataaig.com>
Co-authored-by: Armağan <broccolinisoup@github.com>
  • Loading branch information
3 people committed Jul 23, 2024
1 parent 1c131f8 commit a9fab98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/sixty-trains-flow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

AnchoredOverlay: Add 'className' prop to the component
7 changes: 7 additions & 0 deletions packages/react/src/AnchoredOverlay/AnchoredOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ interface AnchoredOverlayBaseProps extends Pick<OverlayProps, 'height' | 'width'
* Settings to apply to the Focus Zone on the internal `Overlay` component.
*/
focusZoneSettings?: Partial<FocusZoneHookSettings>

/**
* Optional className to be added to the overlay component.
*/
className?: string
}

export type AnchoredOverlayProps = AnchoredOverlayBaseProps &
Expand Down Expand Up @@ -106,6 +111,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr
align = 'start',
alignmentOffset,
anchorOffset,
className,
}) => {
const anchorRef = useProvidedRefOrCreate(externalAnchorRef)
const [overlayRef, updateOverlayRef] = useRenderForcingRef<HTMLDivElement>()
Expand Down Expand Up @@ -191,6 +197,7 @@ export const AnchoredOverlay: React.FC<React.PropsWithChildren<AnchoredOverlayPr
top={position?.top || 0}
left={position?.left || 0}
anchorSide={position?.anchorSide}
className={className}
{...overlayProps}
>
{children}
Expand Down

0 comments on commit a9fab98

Please sign in to comment.