Skip to content

Commit

Permalink
feat: tooltip: allow passing custom class and style to tooltip wrapper (
Browse files Browse the repository at this point in the history
  • Loading branch information
ychhabra-eightfold authored Jul 26, 2022
1 parent 19f9217 commit 4eeb0e4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/components/Tooltip/Tooltip.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export const Tooltip: FC<TooltipProps> = ({
hideAfter = 0,
tabIndex = 0,
positionStrategy = 'absolute',
wrapperClassNames,
wrapperStyle,
...rest
}) => {
const tooltipSide: string = placement.split('-')?.[0];
Expand Down Expand Up @@ -101,6 +103,7 @@ export const Tooltip: FC<TooltipProps> = ({

const referenceWrapperClasses: string = mergeClasses([
styles.referenceWrapper,
wrapperClassNames,
{ [styles.disabled]: disabled },
]);

Expand Down Expand Up @@ -128,6 +131,7 @@ export const Tooltip: FC<TooltipProps> = ({
<>
<div
className={referenceWrapperClasses}
style={wrapperStyle}
id={tooltipId.current}
onMouseEnter={toggle(true)}
onFocus={toggle(true)}
Expand Down
8 changes: 8 additions & 0 deletions src/components/Tooltip/Tooltip.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,12 @@ export interface TooltipProps extends OcBaseProps<HTMLDivElement> {
* @default 0
*/
tabIndex?: number;
/**
* Wrapper class name
*/
wrapperClassNames?: string;
/**
* Wrapper style
*/
wrapperStyle?: React.CSSProperties;
}

0 comments on commit 4eeb0e4

Please sign in to comment.