Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

abaabil.combobox

Package Overview
Dependencies
Maintainers
0
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil.combobox

  • 0.0.19
  • unpublished
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-87.5%
Maintainers
0
Weekly downloads
 
Created
Source

ComboBox Component

npm version npm downloads

The ComboBox component is a versatile and customizable dropdown selection component built with React. It supports different variants, sizes, icons, and states, making it suitable for a wide range of use cases.

Usage

import React, { useState } from 'react';
import ComboBox from './path-to-combobox';

const options = [
  { key: '1', label: 'Option 1', icon: 'icon1' },
  { key: '2', label: 'Option 2', icon: 'icon2' },
  { key: '3', label: 'Option 3', icon: 'icon3' },
];

const App = () => {
  const [selectedOption, setSelectedOption] = useState(null);

  const handleChange = (option) => {
    setSelectedOption(option);
    console.log('Selected option:', option);
  };

  return (
    <div>
      <ComboBox
        options={options}
        placeholder="Select an option"
        onChange={handleChange}
        variant="primary"
        size="base"
      />
    </div>
  );
};

export default App;

Props

PropTypeDefaultDescription
iconstringnullIcon to display in the button. Uses the Icon component.
actionIconstringnullIcon to display on the right side of the button. Uses the Icon component.
sizestringbaseThe size of the button. Can be sm, base, or lg.
optionsarray[]Array of options to display in the dropdown. Each option should be an object with key, label, and optionally icon.
variantstringprimaryThe button variant. Can be primary, secondary, tertiary, success, or error.
onChangefunctionnullCallback function to handle selection changes.
placeholderstring''Placeholder text to display in the button when no option is selected.
classNamestring''Additional class names to apply to the button.
fullWidthbooleanfalseWhether the button should take the full width of its container.
roundedbooleanfalseWhether the button should have rounded corners.
outlinedbooleanfalseWhether the button should be outlined.

Variants

  • primary: Default button style with primary background and text.
  • secondary: Secondary button style with secondary background and text.
  • tertiary: Tertiary button style with tertiary background and text.
  • success: Success button style with success background and text.
  • error: Error button style with error background and text.

Sizes

  • sm: Small button size.
  • base: Base button size.
  • lg: Large button size.

Example

import React, { useState } from 'react';
import ComboBox from './path-to-combobox';

const options = [
  { key: '1', label: 'Option 1', icon: 'icon1' },
  { key: '2', label: 'Option 2', icon: 'icon2' },
  { key: '3', label: 'Option 3', icon: 'icon3' },
];

const Example = () => {
  const [selectedOption, setSelectedOption] = useState(null);

  const handleChange = (option) => {
    setSelectedOption(option);
    console.log('Selected option:', option);
  };

  return (
    <div>
      <ComboBox
        options={options}
        placeholder="Select an option"
        onChange={handleChange}
        variant="primary"
        size="base"
      />
    </div>
  );
};

export default Example;

This example demonstrates various ways to use the ComboBox component, showcasing different variants, sizes, and states.

FAQs

Package last updated on 03 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc