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-dropdown

v0.128.0

Published

A cross-platform React dropdown menu component that displays a list of actions when triggered. Supports controlled and uncontrolled modes.

Readme

Dropdown

A cross-platform React dropdown menu component that displays a list of actions when triggered. Supports controlled and uncontrolled modes.

Installation

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

Demo

Basic Dropdown

import * as React from 'react';
import { Dropdown, DropdownItem } from '@xsolla/xui-dropdown';
import { Button } from '@xsolla/xui-button';

export default function BasicDropdown() {
  return (
    <Dropdown trigger={<Button>Open Menu</Button>}>
      <DropdownItem onPress={() => console.log('Edit')}>Edit</DropdownItem>
      <DropdownItem onPress={() => console.log('Duplicate')}>Duplicate</DropdownItem>
      <DropdownItem onPress={() => console.log('Delete')}>Delete</DropdownItem>
    </Dropdown>
  );
}

Dropdown with Icons

import * as React from 'react';
import { Dropdown, DropdownItem } from '@xsolla/xui-dropdown';
import { Button } from '@xsolla/xui-button';
import { Copy } from '@xsolla/xui-icons';
import { Edit, TrashCan } from '@xsolla/xui-icons-base';

export default function DropdownWithIcons() {
  return (
    <Dropdown trigger={<Button>Actions</Button>}>
      <DropdownItem icon={<Edit size={16} />}>Edit</DropdownItem>
      <DropdownItem icon={<Copy size={16} />}>Duplicate</DropdownItem>
      <DropdownItem icon={<TrashCan size={16} />}>Delete</DropdownItem>
    </Dropdown>
  );
}

Controlled Dropdown

import * as React from 'react';
import { Dropdown, DropdownItem } from '@xsolla/xui-dropdown';
import { Button } from '@xsolla/xui-button';

export default function ControlledDropdown() {
  const [isOpen, setIsOpen] = React.useState(false);

  return (
    <div>
      <Dropdown
        trigger={<Button>Menu</Button>}
        isOpen={isOpen}
        onOpenChange={setIsOpen}
      >
        <DropdownItem onPress={() => setIsOpen(false)}>Action 1</DropdownItem>
        <DropdownItem onPress={() => setIsOpen(false)}>Action 2</DropdownItem>
      </Dropdown>
      <p>Dropdown is: {isOpen ? 'Open' : 'Closed'}</p>
    </div>
  );
}

Selection Indicator

import * as React from 'react';
import { Dropdown, DropdownItem } from '@xsolla/xui-dropdown';
import { Button } from '@xsolla/xui-button';

export default function SelectionDropdown() {
  const [selected, setSelected] = React.useState('option1');

  return (
    <Dropdown trigger={<Button>Select Option</Button>}>
      <DropdownItem
        selected={selected === 'option1'}
        onPress={() => setSelected('option1')}
      >
        Option 1
      </DropdownItem>
      <DropdownItem
        selected={selected === 'option2'}
        onPress={() => setSelected('option2')}
      >
        Option 2
      </DropdownItem>
      <DropdownItem
        selected={selected === 'option3'}
        onPress={() => setSelected('option3')}
      >
        Option 3
      </DropdownItem>
    </Dropdown>
  );
}

Anatomy

import { Dropdown, DropdownItem } from '@xsolla/xui-dropdown';

<Dropdown
  trigger={<TriggerElement />}  // Element that opens dropdown
  isOpen={boolean}              // Controlled open state
  onOpenChange={handler}        // Open state change handler
  width={200}                   // Custom dropdown width
>
  <DropdownItem
    onPress={handler}           // Click handler
    icon={<Icon />}             // Leading icon
    selected={boolean}          // Show selection checkmark
    disabled={boolean}          // Disabled state
  >
    Item Label
  </DropdownItem>
</Dropdown>

API Reference

Dropdown

Container component for dropdown menu.

Dropdown Props:

| Prop | Type | Default | Description | | :--- | :--- | :------ | :---------- | | trigger | ReactNode | - | Required. Element that triggers dropdown. | | children | ReactNode | - | Required. DropdownItem components. | | isOpen | boolean | - | Controlled open state. | | onOpenChange | (open: boolean) => void | - | Open state change handler. | | width | string \| number | - | Custom dropdown width. |


DropdownItem

Individual menu item component.

DropdownItem Props:

| Prop | Type | Default | Description | | :--- | :--- | :------ | :---------- | | children | ReactNode | - | Required. Item content. | | onPress | () => void | - | Click handler. | | icon | ReactNode | - | Leading icon. | | selected | boolean | false | Show selection checkmark. | | active | boolean | false | Active/hover state. | | disabled | boolean | false | Disabled state. |

Behavior

  • Clicking outside the dropdown closes it
  • Selected items show a checkmark and highlighted background
  • Disabled items are visually muted and not clickable
  • Dropdown positions below trigger by default

Accessibility

  • Uses role="menu" for dropdown container
  • Items use role="menuitem"
  • Keyboard support for navigation
  • Focus management when opening/closing