npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xsolla/xui-toggletip

v0.100.0

Published

--- title: Toggletip subtitle: Click-triggered popover. description: A cross-platform React toggletip component that displays rich content in a popover triggered by clicking. ---

Readme


title: Toggletip subtitle: Click-triggered popover. description: A cross-platform React toggletip component that displays rich content in a popover triggered by clicking.

Toggletip

A cross-platform React toggletip component that shows rich content (title, body, footer) in a popover when the trigger element is clicked.

Installation

npm install @xsolla/xui-toggletip
# or
yarn add @xsolla/xui-toggletip

Demo

Basic Toggletip

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { IconButton } from '@xsolla/xui-button';
import { HelpCircle } from '@xsolla/xui-icons-base';

export default function BasicToggletip() {
  return (
    <Toggletip
      title="Help"
      content="Click here to learn more about this feature."
    >
      <IconButton
        icon={<HelpCircle size={20} />}
        variant="secondary"
        tone="mono"
        size="sm"
        aria-label="Help"
      />
    </Toggletip>
  );
}

With Footer Actions

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { Button } from '@xsolla/xui-button';
import { Info } from '@xsolla/xui-icons-base';

export default function WithFooter() {
  return (
    <Toggletip
      title="Confirmation"
      content="Are you sure you want to proceed with this action?"
      footer={
        <>
          <Button size="sm" variant="secondary">Cancel</Button>
          <Button size="sm">Confirm</Button>
        </>
      }
    >
      <Button size="sm" iconLeft={<Info size={16} />}>
        Details
      </Button>
    </Toggletip>
  );
}

Different Directions

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { Button } from '@xsolla/xui-button';

export default function Directions() {
  return (
    <div style={{ display: 'flex', gap: 16, padding: 100 }}>
      <Toggletip direction="top" content="Appears above">
        <Button size="sm">Top</Button>
      </Toggletip>
      <Toggletip direction="bottom" content="Appears below">
        <Button size="sm">Bottom</Button>
      </Toggletip>
      <Toggletip direction="left" content="Appears left">
        <Button size="sm">Left</Button>
      </Toggletip>
      <Toggletip direction="right" content="Appears right">
        <Button size="sm">Right</Button>
      </Toggletip>
    </div>
  );
}

Anatomy

import { Toggletip } from '@xsolla/xui-toggletip';

<Toggletip
  title="Title"                // Optional header title
  content="Description"        // Main content (string or ReactNode)
  footer={<Actions />}         // Optional footer actions
  direction="top"              // Placement direction
  autoDirection={true}         // Auto-adjust if near edges
  offset={12}                  // Distance from trigger
  width="288px"                // Popover width
>
  <TriggerElement />
</Toggletip>

Examples

Feature Explanation

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { HelpCircle } from '@xsolla/xui-icons-base';

export default function FeatureHelp() {
  return (
    <div style={{ display: 'flex', alignItems: 'center', gap: 8 }}>
      <span>Premium Features</span>
      <Toggletip
        title="Premium Benefits"
        content={
          <ul style={{ margin: 0, paddingLeft: 20 }}>
            <li>Unlimited downloads</li>
            <li>Priority support</li>
            <li>Advanced analytics</li>
            <li>Custom branding</li>
          </ul>
        }
      >
        <HelpCircle size={16} style={{ cursor: 'pointer' }} />
      </Toggletip>
    </div>
  );
}

Info Popover

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { Button } from '@xsolla/xui-button';

export default function InfoPopover() {
  return (
    <Toggletip
      title="Payment Information"
      content="Your payment will be processed securely through our payment provider. You will receive a confirmation email once the transaction is complete."
      footer={
        <Button size="sm" variant="secondary">Learn More</Button>
      }
      direction="bottom"
      width="320px"
    >
      <Button size="sm" variant="secondary">
        Payment Info
      </Button>
    </Toggletip>
  );
}

Quick Actions

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { Button, IconButton } from '@xsolla/xui-button';
import { MoreVertical, Edit, Copy, Trash } from '@xsolla/xui-icons-base';

export default function QuickActions() {
  return (
    <Toggletip
      content={
        <div style={{ display: 'flex', flexDirection: 'column', gap: 8 }}>
          <Button size="sm" variant="secondary" iconLeft={<Edit size={16} />} fullWidth>
            Edit
          </Button>
          <Button size="sm" variant="secondary" iconLeft={<Copy size={16} />} fullWidth>
            Duplicate
          </Button>
          <Button size="sm" variant="secondary" tone="alert" iconLeft={<Trash size={16} />} fullWidth>
            Delete
          </Button>
        </div>
      }
      direction="bottom-right"
      width="160px"
    >
      <IconButton
        icon={<MoreVertical size={20} />}
        variant="secondary"
        tone="mono"
        size="sm"
        aria-label="More actions"
      />
    </Toggletip>
  );
}

Form Field Help

import * as React from 'react';
import { Toggletip } from '@xsolla/xui-toggletip';
import { Input } from '@xsolla/xui-input';
import { HelpCircle } from '@xsolla/xui-icons-base';

export default function FormFieldHelp() {
  return (
    <div>
      <div style={{ display: 'flex', alignItems: 'center', gap: 4, marginBottom: 4 }}>
        <label>API Key</label>
        <Toggletip
          content="Your API key can be found in the Developer Console under Settings > API Keys. Keep this key secure and never share it publicly."
          direction="right"
        >
          <HelpCircle size={14} style={{ cursor: 'pointer', color: '#666' }} />
        </Toggletip>
      </div>
      <Input placeholder="Enter your API key" />
    </div>
  );
}

API Reference

Toggletip

ToggletipProps:

| Prop | Type | Default | Description | | :--- | :--- | :------ | :---------- | | children | ReactNode | - | Trigger element. | | title | string | - | Optional title in header. | | content | ReactNode | - | Main content (string or element). | | footer | ReactNode | - | Optional footer (usually buttons). | | direction | ToggletipPlacement | "top" | Placement relative to trigger. | | autoDirection | boolean | true | Auto-adjust placement near edges. | | offset | number | 12 | Distance from trigger in pixels. | | width | string | "288px" | Popover width. | | data-testid | string | - | Test identifier. |

ToggletipPlacement:

type ToggletipPlacement =
  | "top"
  | "top-left"
  | "top-right"
  | "bottom"
  | "bottom-left"
  | "bottom-right"
  | "left"
  | "right";

Behavior

  • Opens on trigger click
  • Closes on clicking outside
  • Closes on Escape key
  • Auto-adjusts position to stay in viewport (when autoDirection is true)
  • Shadow and border from theme for visual elevation

Toggletip vs Tooltip

| Feature | Toggletip | Tooltip | | :------ | :-------- | :------ | | Trigger | Click | Hover | | Content | Rich (title, body, footer) | Simple text | | Interaction | Can contain interactive elements | Non-interactive | | Use case | Help text, mini forms, actions | Quick hints |

Accessibility

  • Click-triggered for keyboard accessibility
  • Escape key closes the popover
  • Focus is managed appropriately
  • Content is accessible to screen readers
  • Use descriptive trigger elements