Tooltip

import { Tooltip, Button } from "react-native-magnus";

const tooltipRef = React.createRef();

<Tooltip ref={tooltipRef} text="Best tooltip ever!">
  <Button
    mt="sm"
    block
    onPress={() => {
      if (tooltipRef.current) {
        tooltipRef.current.show();
      }
    }}
  >
    Show Tooltip
  </Button>
</Tooltip>;

Custom tooltip

You can also create custom tooltip content by passing a component instead of string in text prop.

import { Tooltip, Button } from "react-native-magnus";

const tooltipRef = React.createRef();

<Tooltip
  ref={tooltipRef}
  text={
    <Row bg="transparent" alignItems="center" justifyContent="center">
      <Icon name="heart" color="white" />
      <Text color="white" ml="md">
        Custom tooltip content
      </Text>
    </Row>
  }
  bg="red500"
>
  <Button
    mt="sm"
    block
    onPress={() => {
      if (tooltipRef.current) {
        tooltipRef.current.show();
      }
    }}
  >
    Show me tooltip
  </Button>
</Tooltip>;

Props

PropertyDescriptionTypeDefault
mmargin`stringnumber`
mtmargin top`stringnumber`
mrmargin right`stringnumber`
mbmargin bottom`stringnumber`
mlmargin margin left`stringnumber`
mxmargin horizonal`stringnumber`
mymargin vertical`stringnumber`
ppadding`stringnumber`
ptpadding top`stringnumber`
prpadding right`stringnumber`
pbpadding bottom`stringnumber`
plpadding margin left`stringnumber`
pxpadding horizonal`stringnumber`
pypadding vertical`stringnumber`
hheightnumber-
wwidthnumber-
bgbackground colorstring-
minHmininmum heightnumber-
minWminimum widthstring-
roundedborder radius`stringnumber`
roundedTopborder radius top`stringnumber`
roundedBottomborder radius bottom`stringnumber`
roundedLeftborder radius left`stringnumber`
roundedRightborder radius right`stringnumber`
borderColorcolor for borderstring-
borderTopColorcolor for border topstring-
borderRightColorcolor for border rightstring-
borderLeftColorcolor for border leftstring-
borderBottomColorcolor for border bottomstring-
borderWidthwidth for bordernumber-
borderTopWidthwidth for border topnumber-
borderRightWidthwidth for border rightnumber-
borderLeftWidthwidth for border leftnumber-
borderBottomWidthwidth for border bottomnumber-
flexflex property for containernumber-
justifyContentdescribes how to align children within the main axis of their container`“flex-start”“flex-end”
alignItemsdescribes how to align children along the cross axis of their container`“flex-start”“flex-end”
flexDircontrols the direction in which children of a node are laid out`“row”“column”
flexWrapcontrols what happens when children overflow the size of the container along the main axis`“wrap”“nowrap”
flexWrapcontrols what happens when children overflow the size of the container along the main axis`“wrap”“nowrap”
textcontent of tooltip`“string”ReactNode`