Skip to content

Commit 4fd5720

Browse files
Tooltip: User defined id for aria-describedBy (#1561)
1 parent bd87a55 commit 4fd5720

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

index.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3108,6 +3108,10 @@ export interface TooltipProps {
31083108
* The appearance of the Tooltip.
31093109
*/
31103110
appearance?: TooltipAppearance
3111+
/**
3112+
* The id of the tooltip.
3113+
*/
3114+
id?: string
31113115
/**
31123116
* The position the Tooltip is on.
31133117
*/

src/tooltip/src/Tooltip.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const Tooltip = memo(function Tooltip(props) {
2222
statelessProps = emptyProps
2323
} = props
2424

25-
const id = useId('evergreen-tooltip')
25+
const id = useId('evergreen-tooltip', props.id)
2626
const [isShown, setIsShown] = useState(propIsShown || false)
2727
const [isShownByTarget, setIsShownByTarget] = useState(false)
2828
const closeTimer = useRef(undefined)
@@ -153,6 +153,11 @@ Tooltip.propTypes = {
153153
*/
154154
appearance: PropTypes.oneOf(['default', 'card']),
155155

156+
/**
157+
* The id of the tooltip.
158+
*/
159+
id: PropTypes.string,
160+
156161
/**
157162
* The position the Popover is on.
158163
*/

0 commit comments

Comments
 (0)