-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
💡 [REQUEST] - Generic Tooltip component #551
Comments
Please assign this issue to me. |
@TheCoderAdi Done, good luck |
Hello @abdou6666 , I hope you're doing well. I have a quick question regarding the use of tooltips in React. Would it be appropriate to use import { Tooltip as MuiTooltip } from "@mui/material";
import React, { ReactNode } from "react";
type TooltipProps = {
children: ReactNode;
text: string;
position?:
| "top"
| "bottom"
| "left"
| "right"
| "top-start"
| "top-end"
| "bottom-start"
| "bottom-end"
| "left-start"
| "left-end"
| "right-start"
| "right-end";
};
export const ToolTip: React.FC<TooltipProps> = ({
children,
text,
position = "top",
}) => {
return (
<MuiTooltip title={text} placement={position} arrow>
<div>{children}</div>
</MuiTooltip>
);
}; I’d appreciate your thoughts on whether this approach is suitable or if I should consider implementing a custom tooltip solution. Thank you! |
@TheCoderAdi Yes, you can use MUI Tooltip. Just make sure it meets the acceptance criteria |
Hi @TheCoderAdi I'd like to take this on if you're busy atm. FYI @abdou6666 |
Hey , I am working on it , I will push the code by tomorrow. |
Hello @abdou6666, I have submitted the pull request with the recent updates. Please review it at your convenience and let me know if any changes are required. Looking forward to your feedback. Best regards, |
Start Date
No response
Implementation PR
No response
Reference Issues
No response
Summary
You can inspire from Shadcn/ui implementation and api here
Acceptance criteria:
Basic Example
const Tooltip = ({ children, text, position = "top" }) => {
const [visible, setVisible] = useState(false);
return (
<div
className="tooltip-container"
onMouseEnter={() => setVisible(true)}
onMouseLeave={() => setVisible(false)}
>
{children}
{visible && (
<div className={
tooltip-box tooltip-${position}
}>{text}
)}
);
};
Drawbacks
Unresolved questions
No response
The text was updated successfully, but these errors were encountered: