HomePaymentsNo-codeDevelopersContribute
Safepay Home PageLive DashboardTest Dashboard

Tooltip


The Tooltip component is used to provide contextual information when users hover over or focus on an element. It enhances user interaction by delivering helpful insights without cluttering the UI. The component is built using the Root, Trigger, and Content elements to provide a complete tooltip functionality.

Usage

Tooltip Component Usage
import React from 'react';
import { Root, Trigger, Content } from '~/ui/components/Tooltip';
import { Button } from '@sfpy/styleguide'
import { TrashIcon } from 'lucide-react'

export default function App() {
  return (
    <Root>
      <Trigger asChild>
        <Button
          theme="primary-destructive"
          size="md"
          leftSlot={<TrashIcon />}
        />
      </Trigger>
      <Content>Delete this attachment</Content>
    </Root>
  );
}

Rendered Example

Props

Root

NameTypeDefaultDescription
delayDurationnumber0Duration in milliseconds before showing the tooltip after a hover or focus

Trigger

NameTypeDefaultDescription
asChildbooleanfalseIf true, wraps the child component directly to use its own element as the trigger

Content

NameTypeDefaultDescription
sideOffsetnumber4The offset from the trigger element in pixels
classNamestringundefinedAdditional CSS classes for styling the tooltip

This documentation details how to implement and customize the Tooltip component, providing a dynamic way to present additional information in a user-friendly manner. If you need further details or another component documented, please let me know!