Tooltips
Is a component that displays a tooltip when the user hovers over an element.
Tooltip usage
Predisposition
Before usage, you need to wrap your
App
inTooltips
provider
import { Tooltips } from '@atlasgroup/react-atlantic';// App.tsxexport const App = () => (<OtherProvider><Tooltips>// Your app</Tooltips></OtherProvider>);
Then you are set to go for specific tooltip usage
import { useTooltip, Text } from '@atlasgroup/react-atlantic';export const Component = () => {const tooltip = useTooltip();return (<Text ref={tooltip} data-title="Text to display" data-position="left">Czech Republicπ¨πΏ</Text>);};
Different positions
Tooltips provider props
hideTooltips
You can hide the tooltips globally by passing
hideTooltip
prop toTooltips
provider
<Tooltips hideTooltips={true}>{/*Component*/}</Tooltips>
contentAttr
You can also pass
contentAttr
&positionAttr
props to theTooltips
provider to change thecontent
andposition
attribute of tooltips respectivelly
<Tooltips contentAttr="data-content" positionAttr="data-place">{/*Component*/}</Tooltips>
Tooltip
Last but not least, you can pass
Tooltip
prop to theTooltips
provider to change the component used for tooltips
const StyledTooltip = styled.div`color: red;`;<Tooltips Tooltip={StyledTooltip}>{/*Component*/}</Tooltips>;