Skip to content

Commit

Permalink
🏷️ Allow ReactNode as title in Tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
magnh committed May 23, 2024
1 parent af36ebd commit d275688
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/eds-core-react/src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
cloneElement,
useMemo,
useEffect,
ReactNode,
} from 'react'
import styled from 'styled-components'
import {
Expand Down Expand Up @@ -76,12 +77,12 @@ export type TooltipProps = {
/** Tooltip placement relative to anchor */
placement?: Placement
/** Tooltip title */
title?: string
title?: ReactNode
/** Tooltip anchor element */
children: React.ReactElement & React.RefAttributes<HTMLElement>
/** Delay in ms, default 100 */
enterDelay?: number
} & HTMLAttributes<HTMLDivElement>
} & Omit<HTMLAttributes<HTMLDivElement>, 'title'>

export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
function Tooltip(
Expand All @@ -90,7 +91,7 @@ export const Tooltip = forwardRef<HTMLDivElement, TooltipProps>(
) {
const arrowRef = useRef<HTMLDivElement>(null)
const [open, setOpen] = useState(false)
const shouldOpen = title !== ''
const shouldOpen = Boolean(title)

const {
x,
Expand Down

0 comments on commit d275688

Please sign in to comment.