Skip to main content

Tooltip

Tooltip displays a short informative text when the user interacts with an anchor element. It is positioned relative to the anchor and dismissed by pressing the backdrop.

Import

import { Tooltip } from '@ui-kitten/components';

Basic Usage

import React, { useState } from 'react';
import { Layout, Tooltip, Button } from '@ui-kitten/components';

const TooltipExample = () => {
const [visible, setVisible] = useState(false);

const renderToggleButton = () => (
<Button onPress={() => setVisible(true)}>Show Tooltip</Button>
);

return (
<Layout style={{ flex: 1, padding: 16 }}>
<Tooltip
visible={visible}
anchor={renderToggleButton}
onBackdropPress={() => setVisible(false)}
>
This is a tooltip message
</Tooltip>
</Layout>
);
};

Props

PropertyTypeDefaultDescription
visiblebooleanfalseWhether the tooltip is visible.
anchor() => ReactElement-Render function for the anchor element the tooltip is positioned relative to.
onBackdropPress() => voidundefinedCalled when the area outside the tooltip is pressed.
placement'top' | 'bottom' | 'left' | 'right''top'Position of the tooltip relative to the anchor.
childrenReactText | (props) => ReactElement-Tooltip content text or render function.

Storybook

Live examples coming soon via Storybook.