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

makyo-technical-test

v0.1.0

Published

Reusable **Select / Multi-Select** React component with optional search and automatic portal behavior for overflow containers.

Readme

Select Component

Reusable Select / Multi-Select React component with optional search and automatic portal behavior for overflow containers.


Features

  • Single select & multi select
  • Optional search with highlight
  • Automatically uses createPortal when inside overflow containers
  • Auto reposition on scroll & resize
  • TailwindCSS friendly

Basic Usage (Single Select)

import { useState } from "react";
import { Select } from "@/components/Select";

const options = [
  { label: "Apple", value: "apple" },
  { label: "Banana", value: "banana" },
  { label: "Orange", value: "orange" },
];

export default function Example() {
  const [value, setValue] = useState<string>("");

  return (
    <Select
      label="Fruit"
      options={options}
      value={value}
      onChange={setValue}
      placeholder="Select fruit"
    />
  );
}

Multi Select Usage

import { useState } from "react";
import { Select } from "@/components/Select";

export default function Example() {
  const [values, setValues] = useState<string[]>([]);

  return (
    <Select
      label="Fruits"
      options={options}
      value={values}
      onChange={setValues}
      multiple
      placeholder="Select fruits"
    />
  );
}

With Search

Enable search inside dropdown:

<Select
  label="Fruits"
  options={options}
  value={value}
  onChange={setValue}
  withSearch
  placeholder="Search fruit"
/>

Search will:

  • Filter visually
  • Highlight matching text

Props

| Prop | Type | Default | Description | |--------------|--------------------------|---------|-------------| | label | string | label | Label displayed on the left | | options | { label, value }[] | — | Select options | | value | string \| string[] | — | Selected value(s) | | onChange | (value) => void | — | Change handler | | multiple | boolean | false | Enable multi-select | | withSearch | boolean | false | Enable search input | | placeholder| string | "" | Placeholder text |


Notes

  • When placed inside containers with overflow: auto | hidden | scroll, the dropdown automatically renders via React Portal to document.body.
  • Dropdown position updates on scroll and resize.
  • Z-index is set to 2147483647 to avoid clipping issues.

Storybook

This component is documented and testable via Storybook.

Story Setup

import type { Meta, StoryObj } from "@storybook/react";
import { useEffect, useState } from "react";
import { Select } from "./Select";

const meta: Meta<typeof Select> = {
  title: "Components/Select",
  component: Select,
  argTypes: {
    multiple: { control: "boolean" },
    withSearch: { control: "boolean" },
    placeholder: { control: "text" },
    label: { control: "text" },
  },
};

export default meta;

type Story = StoryObj<typeof Select>;

Controlled Wrapper (Recommended)

Because Select is a controlled component, it is recommended to wrap it with local state in Storybook:

const SelectWrapper = (args: React.ComponentProps<typeof Select>) => {
  const [value, setValue] = useState<string | string[]>(
    args.multiple ? [] : "",
  );

  useEffect(() => {
    setValue(args.multiple ? [] : "");
  }, [args.multiple]);

  return <Select {...args} value={value} onChange={setValue} />;
};

Example Story

export const SelectDropdownField: Story = {
  args: {
    multiple: true,
    withSearch: true,
    options: [
      { label: "Option 1", value: "1" },
      { label: "Option with icon", value: "2" },
      { label: "Long Long Option 3", value: "3" },
      { label: "Long Long Long Option 4", value: "4" },
      { label: "Long Long Long Long Option 5", value: "5" },
    ],
  },
  render: (args) => <SelectWrapper {...args} />,
};

This setup allows you to:

  • Toggle multiple and withSearch dynamically
  • Test controlled behavior correctly
  • Preview long option lists & overflow behavior

Styling

This component uses Tailwind CSS utility classes.