diff --git a/src/components/Popover/Popover.tsx b/src/components/Popover/Popover.tsx index d46a0e2b9..6d598fbd9 100644 --- a/src/components/Popover/Popover.tsx +++ b/src/components/Popover/Popover.tsx @@ -72,6 +72,10 @@ interface PopoverProps { * Popover content (can be any valid React Element or component containing React Elements) */ content: React.ReactNode; + /** + * Popover content padding + */ + padding?: string | number; /** * Optional: Specify the Popover content placement (it changes automatically if the Popover content cannot fit inside the viewport with the selected placement) */ @@ -97,6 +101,7 @@ interface PopoverProps { const Popover: React.FC = ({ children, content = '', + padding = undefined, placement = 'bottom-start', offset = 5, isOpen = false, @@ -228,12 +233,11 @@ const Popover: React.FC = ({ - {content} + {content} )} diff --git a/src/components/Popover/PopoverContent.tsx b/src/components/Popover/PopoverContent.tsx index 756c2fbb9..9d7ca6e55 100644 --- a/src/components/Popover/PopoverContent.tsx +++ b/src/components/Popover/PopoverContent.tsx @@ -4,20 +4,28 @@ import styled from 'styled-components'; import { Spaces } from '../../essentials'; import { Card } from '../Card/Card'; +const DEFAULT_PADDING = Spaces[2]; + interface PopoverContentProps { /** * Popover content (can be any valid React Element or component) */ children: React.ReactNode; + /** + * Popover content padding + */ + padding: string | number; } -const PopoverContentContainer = styled(Card)` +const PopoverContentContainer = styled(Card)<{ padding: string | number }>` display: block; - padding: ${Spaces[2]}; + padding: ${props => props.padding}; `; -export const PopoverContent = ({ children }: PopoverContentProps): React.ReactElement => ( +export const PopoverContent = ({ padding = DEFAULT_PADDING, children }: PopoverContentProps): React.ReactElement => ( <> - {children} + + {children} + ); diff --git a/src/components/Popover/docs/Popover.mdx b/src/components/Popover/docs/Popover.mdx index dbabca6c7..52ebca34f 100644 --- a/src/components/Popover/docs/Popover.mdx +++ b/src/components/Popover/docs/Popover.mdx @@ -113,6 +113,21 @@ The Popover supports: ```
+### With No Padding + + + + + + + +```jsx + + + +``` +
+ ## Playground