bymax-components

bymax React Select component

Is a component created using the react-select component, a flexible and beautiful select input control for ReactJS with multiselect, singleselect and search system.

Customized to facilitate its use, it has an animation feature with its placeholder text which can be used as the title of the component and properties that help in integration with the formik forms component.

The bymax React Select component was designed for use in forms that work with cryptocurrencies, but it was also developed to work with any type of data.

npm LICENSE MIT

NPM

storybook

Getting Started

Installation

npm i bymax-react-select --save

or

yarn add bymax-react-select

Usage

JavaScript Example
App.js
import React, { useMemo, useState } from "react";
import { Select } from "bymax-react-select";

export default function App() {
  const options = useMemo(() => [
      {
        id: 1, // acts as primary key, should be unique and non-empty
        value: "BTC",
        label: "Bitcoin",
        image: "path to your images/image.svg",
        base: "BTC",
        quote: "USDT",
      },
      {
        id: 2,
        value: "eth",
        label: "Ethereum",
        base: "ETH",
      },
      {
        id: 3,
        value: "sol",
        label: "Solana",
      },
    ],[]);

  const [value, setValue] = useState(options[0]);

  return (
    <Select
      id="example-id"
      value={value}
      isMulti={false}
      isClearable={true}
      options={options}
      placeholder="Select a coin"
      noOptionsMessage="No coins found"
      onChange={(selectedOption) =>
        setValue(selectedOption)
      }
    />
  );
}
TypeScript Example
App.tsx
import React, { useMemo, useState } from "react";
import { Select, Option } from "bymax-react-select";

export default function App() {
  const options: Option[] = useMemo(() => [
    {
      id: "1", // acts as primary key, should be unique and non-empty
      value: "BTC",
      label: "Bitcoin",
      image: "path to your images/image.svg",
      base: "BTC",
      quote: "USDT",
    },
    {
      id: "2",
      value: "eth",
      label: "Ethereum",
      base: "ETH",
    },
    {
      id: "3",
      value: "sol",
      label: "Solana",
    },
  ], []);

  const [value, setValue] = useState<Option | Option[] | null>(options[0]);

  return (
    <Select
      id="example-id"
      value={value}
      isMulti={true}
      isClearable={true}
      options={options}
      placeholder="Select a coin"
      noOptionsMessage="No coins found"
      onChange={(selectedOption) =>
        setValue(selectedOption)
      }
    />
  );
}

Props

Contributions

Fork and create a pull request

License

MIT License

Was I able to help you? Buy me a coffee!

Bitcoin:  bc1qx0jwnwkum3xxz77ge86qgpumk4plzgrkmxh5aw

Ethereum:  0xb3718C66311eFcC7a868973205E0Dca6dB05822e

Solana:  9GZ6sJj6xHbH2KdgMz1WEmJ86HUmSMgxkszwVjhnRfky

Polygon:  0xb3718C66311eFcC7a868973205E0Dca6dB05822e