Skip to content

Commit

Permalink
Allow margin reset on inline popover via inline styles
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Aug 8, 2024
1 parent 9e3b9ae commit 6c3b96a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const GridVisualizerGrid = forwardRef(
'is-dropping-allowed': isDroppingAllowed,
} ) }
clientId={ gridClientId }
contentStyle={ { margin: 0 } }
>
<div
ref={ ref }
Expand Down
7 changes: 6 additions & 1 deletion packages/components/src/popover/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const UnforwardedPopover = (
shift = false,
inline = false,
variant,
contentStyle,

// Deprecated props
__unstableForcePosition,
Expand Down Expand Up @@ -370,6 +371,7 @@ const UnforwardedPopover = (
const animationProps: HTMLMotionProps< 'div' > = shouldAnimate
? {
style: {
...contentStyle,
...motionInlineStyles,
...style,
},
Expand All @@ -378,7 +380,10 @@ const UnforwardedPopover = (
}
: {
animate: false,
style,
style: {
...contentStyle,
...style,
},
};

// When Floating UI has finished positioning and Framer Motion has finished animating
Expand Down
7 changes: 7 additions & 0 deletions packages/components/src/popover/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,13 @@ export type PopoverProps = {
* @default false
*/
inline?: boolean;
/**
* Styles to apply to the main popover element.
*
* @default undefined
*/
contentStyle?: React.CSSProperties;

// Deprecated props
/**
* Prevent the popover from flipping and resizing when meeting the viewport
Expand Down

0 comments on commit 6c3b96a

Please sign in to comment.