Skip to content

Commit

Permalink
fix(Tag): add forwardRef
Browse files Browse the repository at this point in the history
- allows to use in HvTooltip
  • Loading branch information
zettca authored and plagoa committed Jan 12, 2024
1 parent f714de7 commit d2a47c7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/core/src/Tag/Tag.tsx
@@ -1,4 +1,4 @@
import React, { HTMLAttributes } from "react";
import React, { HTMLAttributes, forwardRef } from "react";
import { HvColorAny, getColor } from "@hitachivantara/uikit-styles";
import Chip, { ChipProps as MuiChipProps } from "@mui/material/Chip";

Expand Down Expand Up @@ -71,7 +71,7 @@ const getCategoricalColor = (customColor?: HvColorAny, colors?: any) => {
*
* It leverages the Chip component from Material UI
*/
export const HvTag = (props: HvTagProps) => {
export const HvTag = forwardRef<HTMLDivElement, HvTagProps>((props, ref) => {
const {
classes: classesProp,
className,
Expand Down Expand Up @@ -135,6 +135,7 @@ export const HvTag = (props: HvTagProps) => {

return (
<Chip
ref={ref}
label={label}
disabled={disabled}
className={cx({ [clickableClass]: isClickable }, className)}
Expand Down Expand Up @@ -170,4 +171,4 @@ export const HvTag = (props: HvTagProps) => {
{...others}
/>
);
};
});

0 comments on commit d2a47c7

Please sign in to comment.