1.1.0 • Published 1 year ago

react-country-dropdown v1.1.0

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

react-country-dropdown

A simple dropdown menu for selecting countries :rocket:

David GitHub npm bundle size GitHub package.json version

Install

npm install --save react-country-dropdown

Usage

import React, { Component } from 'react'

import { ReactCountryDropdown } from 'react-country-dropdown'
import 'react-country-dropdown/dist/index.css'

const Example = () => {
  const handleSelect = (country) => {
    console.log(country)
    /* returns the details on selected country as an object
    	{
          name: "United States of America", 
          code: "US", 
          capital: "Washington, D.C.", 
          region: "Americas", 
          latlng: [38, -97]
        }
    */
  }
  return (
    <div>
      <ReactCountryDropdown onSelect={handleSelect} countryCode='IN' />
    </div>
  )
}

(If you dont select set a default country with "countryCode" ; Then by default the selected country will US.)

License

MIT © RocktimSaikia

1.1.0

1 year ago

1.0.2

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago