0.0.5 • Published 7 years ago

flagstrap-preact v0.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

<Flagstrap /> for Preact

A dropdown component that makes it possible to choose a country from a list. This component is suited only together with Bootstrap 3 styles and is a direct port of the following plugin

Installation

$ npm install flagstrap-preact

Make sure to enable transpilation for this module! Check .babelrc and webpack configuration if you have troubles.

Usage Example

const onChanged = (countryCode) => {
  console.log('new selected country: ', countryCode);
}

<Flagstrap
  countries={
    'AF': 'Afghanistan',
    'AL': 'Albania',
    'DZ': 'Algeria',
    'AS': 'American Samoa'
  }
  choose={'Choose language'}
  onChange={onChanged}
/>

Demo


Props

PropTypeDescription
countriesObjectObject containing country code as keys and country names as values
chooseStringDefault dropdown label.
selectedStringDefault selected country code
onChangeFunctionProp to handle dropdown change outside of Flagstrap component

License

MIT

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago