1.0.8 • Published 1 year ago

tz-react-simple-select v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

React Simple Select

A React component who provides a select input handling the state value.

Installation

Install tz-react-simple-select with npm

  npm install tz-react-simple-select

or with Yarn

yarn add tz-react-simple-select

Usage/Examples

import { FC, useState } from 'react'
import { Select } from 'tz-react-simple-select'

const App: FC<{}> = () => {
  const [favoriteIceCreamFlavour, setFavoriteIceCreamFlavour] = useState<string>('')

  const favoriteIceCreamFlavourOpts = [
    {
      label: 'Chocolate',
      value: 'chocolate',
    },
    {
      label: 'Vanilla',
      value: 'vanilla',
    },
    {
      label: 'Cookie',
      value: 'cookie',
    },
    {
      label: 'Mint',
      value: 'Mint',
    },
  ]

  const onChange = (e: ChangeEvent<HTMLInputElement>) => {
    setFavoriteIceCreamFlavour(e.target.value)
  }

  return (
    <div>
      <Select
        label="What's your favorite ice cream flavour ?"
        options={favoriteIceCreamFlavourOpts}
        value={favoriteIceCreamFlavour}
        onChange={setFavoriteIceCreamFlavour}
        id='favoriteFlavour'
      />
    </div>
  )
}

export default App

Feedback

If you have any feedback, please reach out to us at tom.zidani@gmail.com

License

MIT

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago