1.0.5 • Published 9 months ago

super-searchable-selectbox v1.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

����# Super Select

A highly customizable, lightweight, and searchable React dropdown component with advanced features like team-based grouping, avatar toggle, position control, and custom dropdown sizes. This component is perfect for managing user selection in complex UIs, such as task management or scheduling systems.

Features

  • Grouped Teams & Members: Organize users under teams for easy selection.
  • Customizable Dropdown Position: Choose from top, bottom, left, or right.
  • Dropdown Size Variants: Available sizes - xs, sm, md, lg, xl.
  • Avatar Toggle: Optionally show or hide user avatars.
  • Pre-selection: Provide a pre-selected user ID.
  • Lightweight & Fast: Optimized for performance.
  • Accessible Search Bar: Easily search through users.

Installation

Install via NPM:

npm install super-searchable-selectbox

Usage

Here's an example of how to use the SuperSearchableSelectBox component in your React application:

import React from 'react';
import Dropdown, { Team, User } from 'super-searchable-selectbox';

const teams: Team[] = [
  {
    id: 1,
    name: 'Development',
    organization: 'Tech Corp',
    members: [
      { id: 1, name: 'Alice', email: 'alice@example.com', role: 'Developer', title: 'Frontend Dev' },
      { id: 2, name: 'Bob', email: 'bob@example.com', role: 'Developer', title: 'Backend Dev', avatar: 'https://via.placeholder.com/50' }
    ]
  },
  {
    id: 2,
    name: 'Marketing',
    organization: null,
    members: [{ id: 3, name: 'Eve', email: 'eve@example.com', role: 'Marketer', title: 'SEO Expert' }]
  }
];

const App = () => {
  const handleUserSelect = (userId: number | null) => {
    console.log('Selected User ID:', userId);
  };

  return (
    <UserDropdown
      teams={teams}
      onUserSelect={handleUserSelect}
      defaultSelectedUserId={1}
      showAvatar={true}
      showTitle={true}
      dropdownPosition="bottom"
      dropdownSize="md"
    />
  );
};

export default App;

Props

PropTypeDefaultDescription
teamsTeam[]-List of teams with members.
onUserSelect(userId: numbernull) => void-Callback when a user is selected. Sends null if unassigned.
defaultSelectedUserIdnumbernullnullPre-selected user ID.
showAvatarbooleantrueToggle display of user avatars.
showTitlebooleantrueToggle display of team titles.
dropdownPosition'top''bottom''left''right''bottom'Control dropdown position.
dropdownSize'xs''sm''md''lg''xl''md'Control dropdown size.

Dropdown Sizes

SizeWidthMax Height
xs150px150px
sm200px200px
md250px250px
lg300px300px
xl350px350px

Repository

This package is open-source. Feel free to contribute or raise issues in the repository:

https://github.com/vengatbap/super-searchable-selectbox

License

This project is licensed under the MIT License.

Author

Vengatesan B

GitHub: https://github.com/vengatbap/ LinkedIn Instagram: https://www.instagram.com/unknowncoder.me/

1.0.5

9 months ago

1.0.4

9 months ago

1.0.3

9 months ago

1.0.2

9 months ago

1.0.1

9 months ago

1.0.0

9 months ago