Skip to content

Commit

Permalink
feat(@clayui/tooltip): Add the new ContainerProps API
Browse files Browse the repository at this point in the history
  • Loading branch information
matuzalemsteles committed May 19, 2021
1 parent 9e905e8 commit 728600c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/clay-tooltip/src/TooltipProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: BSD-3-Clause
*/

import {ClayPortal, Keys, delegate} from '@clayui/shared';
import {ClayPortal, IPortalBaseProps, Keys, delegate} from '@clayui/shared';
import domAlign from 'dom-align';
import React, {useCallback} from 'react';
import warning from 'warning';
Expand Down Expand Up @@ -139,6 +139,11 @@ interface IPropsBase {
*/
autoAlign?: boolean;

/**
* Props to add to the <ClayPortal/>.
*/
containerProps?: IPortalBaseProps;

/**
* Custom function for rendering the contents of the tooltip
*/
Expand Down Expand Up @@ -171,6 +176,7 @@ const TooltipProvider: React.FunctionComponent<
> = ({
autoAlign = true,
children,
containerProps = {},
contentRenderer = (props) => props.title,
delay = 600,
scope,
Expand Down Expand Up @@ -369,7 +375,7 @@ const TooltipProvider: React.FunctionComponent<
return (
<>
{show && (
<ClayPortal>
<ClayPortal {...containerProps}>
<ClayTooltip alignPosition={align} ref={tooltipRef} show>
{setAsHTML && typeof titleContent === 'string' ? (
<span
Expand Down

0 comments on commit 728600c

Please sign in to comment.