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

@ffid-br/account-selector-component

v0.1.38

Published

An elegant, accessible React account-selection interface with searchable autocomplete, keyboard shortcuts, and full dark-mode support — built with the FFID brand palette.

Downloads

557

Readme

Account Selector Component

An elegant, accessible React account-selection interface with searchable autocomplete, keyboard shortcuts, and full dark-mode support — built with the FFID brand palette.

Features

  • Searchable autocomplete — real-time filtering by account name, group, or ID
  • Keyboard shortcut⌘K (macOS) / Ctrl+K (Windows / Linux) to toggle the selector
  • Full keyboard navigation↑↓ to navigate, Enter to select, Escape to close
  • Grouped accounts — accounts displayed under sticky group headers with proper optgroup-style grouping
  • Dark mode — complete dark-mode support via Tailwind's dark class strategy
  • FFID brand palette — custom ffid-* color tokens in Tailwind config for consistent brand styling
  • Accessible — ARIA combobox / listbox pattern, role="dialog", aria-selected, aria-activedescendant
  • TypeScript — fully typed props, accounts, and settings interfaces
  • Lightweight — only lucide-react and tailwind-merge as runtime dependencies

Installation

npm install @ffid-br/account-selector-component

Quick start

import { useState } from 'react';
import { AccountSelector } from '@ffid-br/account-selector-component';
import '@ffid-br/account-selector-component/dist/style.css';
import type { AccountGroups } from '@ffid-br/account-selector-component';

const accounts: AccountGroups = {
  'FFID': [
    {
      id: 'acc-1',
      name: 'FFID Main',
      type: 'sales',
      support_type: 'online',
      support_name: 'Support',
      settings: {
        domains: ['example.com'],
        feeds: [],
        plugins: [],
        checkout: [],
        success: [],
        short_domain: '',
        script: '',
      },
      account_ownership_owner: 'FFID',
    },
  ],
  'Partner': [
    {
      id: 'acc-2',
      name: 'Partner Store',
      type: 'business',
      support_type: 'premium',
      support_name: 'Alice',
      settings: {
        domains: ['partner.com'],
        feeds: [],
        plugins: ['analytics'],
        checkout: [],
        success: [],
        short_domain: '',
        script: '',
      },
      account_ownership_owner: 'Partner',
    },
  ],
};

function App() {
  const [selectedId, setSelectedId] = useState<string | undefined>();

  return (
    <AccountSelector
      accounts={accounts}
      selectedAccountId={selectedId}
      onAccountSelect={(id) => setSelectedId(id)}
    />
  );
}

Props

| Prop | Type | Required | Description | |------|------|----------|-------------| | accounts | AccountGroups | Yes | Object where each key is a group name and the value is an array of Account objects. Use "" as the key for ungrouped accounts. | | selectedAccountId | string \| undefined | No | ID of the currently selected account. When omitted the first account is auto-selected. | | onAccountSelect | (accountId: string) => void | Yes | Callback fired when the user selects an account. Receives the account id. | | className | string | No | Additional CSS classes merged onto the trigger element via tailwind-merge. |

Keyboard shortcuts

| Shortcut | Action | |----------|--------| | ⌘K / Ctrl+K | Toggle the selector modal (global) | | | Navigate the account list | | Enter | Select the highlighted account | | Escape | Close the modal | | Space / Enter | Open the modal (when the trigger is focused) |

Dark mode

The component uses Tailwind's class dark-mode strategy. Add the dark class to a parent element (typically <html> or <body>) to activate dark mode:

<html class="dark">
  <!-- all AccountSelector elements will render in dark mode -->
</html>

Every interactive state — focus rings, highlights, hover backgrounds, group headers, keyboard-hint badges, and the scrollbar — adapts automatically.

FFID brand palette

The Tailwind config ships with ffid-* color tokens (50–950) used for primary interactive states (focus rings, highlights, checkmarks). You can override or extend these in your own tailwind.config.js:

// tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        ffid: {
          500: '#2f5fff', // primary
          600: '#1a3ff5', // hover / active
          // ... override any shade you need
        },
      },
    },
  },
};

Types

interface AccountSettings {
  domains: string[];
  feeds: any[];
  plugins: string[];
  checkout: any[];
  success: any[];
  short_domain: string;
  script: string;
  [key: string]: any;
}

interface Account {
  id: string;
  name: string;
  type: string;
  support_type: string;
  support_name: string;
  settings: AccountSettings;
  account_ownership_owner: string;
}

interface AccountGroups {
  [key: string]: Account[];
}

interface AccountSelectorProps {
  accounts: AccountGroups;
  selectedAccountId?: string;
  onAccountSelect: (accountId: string) => void;
  className?: string;
}

Running tests

npm test          # single run
npm run test:watch # watch mode

License

MIT