1.0.8 • Published 2 years ago

react-select-group v1.0.8

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

React Select Group

select column with double options for react js form

NPM JavaScript Style Guide

Demo

npm.io

Install

npm install react-select-group

Usage

import React from 'react'
import { ReactSelectGroup } from 'react-select-group'
import 'react-select-group/dist/index.css'

const App = () => {
  const flags = [
    'https://res.cloudinary.com/duzt2dvg6/image/upload/v1665326782/flags/gmail.png',
    'https://res.cloudinary.com/duzt2dvg6/image/upload/v1665326789/flags/outlook.png',
    'https://res.cloudinary.com/duzt2dvg6/image/upload/v1665326776/flags/apple.png',
    'https://res.cloudinary.com/duzt2dvg6/image/upload/v1665326799/flags/yahoo.png'
  ]
  const labels = [
    'Gmail', 'Outlook', 'Apple Mail', 'Yahoo Mail'
  ]
  render() {
    const onChangeValue = (data) => {
      // your logic
    }
    return (
      <ReactSelectGroup 
        placeholder='Type email here'
        isError={error}
        flags={flags}
        labels={labels}
        onChange={onChangeValue} 
      />
    )
  }
}

export default App

Props

PropsTypeDesription
placeholderstringPlaceholder input type on text box
isErrorbooleanHandle custom error. Default is false
flagsarrayElement must image url. Because of show flags on group one or left column
labelsarrayThis is optional. But, if you want describe each flag you can use it. And length of labels array should same with length of flags
onChangefunctionEmit every value to parent. Should print paramater to get result

License

MIT © faridho

1.0.8

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago