PPolaris ComponentsConnect an agent

Tooltip

A short floating hint shown on hover or focus, used to explain a control or a term without cluttering the page.

Preview

Code

Example.jsx
import { Card, BlockStack, InlineStack, Text, Icon, Button, Tooltip } from '@shopify/polaris';
import { InfoIcon, RefreshIcon } from '@shopify/polaris-icons';

export const Example = () => (
  <Card>
    <BlockStack gap="400">
      <Text as="h2" variant="headingMd">
        Inventory sync
      </Text>

      <InlineStack gap="300" blockAlign="center">
        <Tooltip content="Pulls stock levels from your warehouse. Runs automatically every hour.">
          <Button icon={RefreshIcon}>Sync now</Button>
        </Tooltip>
        <Tooltip content="You need the Growth plan to schedule syncs." preferredPosition="above">
          <Button disabled>Schedule sync</Button>
        </Tooltip>
      </InlineStack>

      <InlineStack gap="100" blockAlign="center">
        <Text as="span">Sell when out of stock</Text>
        <Tooltip content="Customers can keep ordering after inventory hits zero." preferredPosition="above">
          <Icon source={InfoIcon} tone="subdued" />
        </Tooltip>
      </InlineStack>

      <Text as="p" tone="subdued">
        The last sync finished 12 minutes ago and updated{' '}
        <Tooltip content="42 of 1,248 products changed since the previous run." preferredPosition="below">
          <Text as="span" fontWeight="semibold">
            42 products
          </Text>
        </Tooltip>
        .
      </Text>
    </BlockStack>
  </Card>
);