npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

concierge-flags

v1.1.34

Published

concierge-flags

Downloads

10

Readme

react-flags-select

This is a hacked version of react-flags-select. It is not useful to anyone.

Travis npm package Coveralls

A customizable svg flags select components for React Js.

Demo and Example

Live demo: ekwonye-richard.github.io/react-flags-select/

Installation

The package can be installed via NPM:

npm install react-flags-select --save

react-flags-select can be imported as follows

import ReactFlagsSelect from 'react-flags-select';

//import css module
import 'react-flags-select/css/react-flags-select.css';

//OR import sass module
import 'react-flags-select/scss/react-flags-select.scss';

Usage

    <ReactFlagsSelect />

All country Codes: Country Codes

Default Country

You can select a default country to be rendered.

    <ReactFlagsSelect
    defaultCountry="US" />

Searchable

You can enable search filter using prop searchable.

    <ReactFlagsSelect
    searchable={true}/>

Countries

You can use an array of countries rather than the full list of countries.

    <ReactFlagsSelect
    countries={["US", "GB", "FR", "DE", "IT", "NG"]} />

or create a black list of countries

    <ReactFlagsSelect
    countries={["US", "GB", "FR", "DE", "IT", "NG"]}
    blackList={true} />

Custom Labels

You can use an object of countries labels to replace the countries name. The default country name for a country will be used when the country code has no label passed.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}} />

Placeholder

You can replace the default placeholder text.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}}
    placeholder="Select Language" />

Show Selected Label

You can hide or show the label of a selected flag. The default value is true.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}}
    placeholder="Select Language"
    showSelectedLabel={false} />

Show Option Label

You can hide or show the label of the flags in the options dropdown. The default value is true.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}}
    placeholder="Select Language"
    showSelectedLabel={false}
    showOptionLabel={false} />

Selected Size

You can set the size in pixels for the svg flag and label of the selected option.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}}
    placeholder="Select Language"
    showSelectedLabel={false}
    showOptionLabel={false}
    selectedSize={14} />

Options Size

You can set the size in pixels for the svg flags and labels in the options dropdown.

    <ReactFlagsSelect
    countries={["US", "GB", "FR","DE","IT"]}
    customLabels={{"US": "EN-US","GB": "EN-GB","FR": "FR","DE": "DE","IT": "IT"}}
    placeholder="Select Language"
    showSelectedLabel={false}
    showOptionLabel={false}
    selectedSize={18}
    optionsSize={14} />

className

You can pass a style className that will be attached to the top-level div of the component.

    <ReactFlagsSelect
    className="menu-flags" />

Align Options

You can align the options dropdown to either left or right. The default value is right.

    <ReactFlagsSelect
    alignOptions="left" />

Disabled

You can disable the options dropdown, however the selected country can be updated using the updateSelected() method. This can be used for flag badges.

    <ReactFlagsSelect
    defaultCountry="US"
    showSelectedLabel={false}
    disabled={true} />

onSelect

You can use onSelect event handler which fires each time an option is selected. onSelect(countryCode).

    //onSelect Method
    onSelectFlag(countryCode){
        console.log(countryCode)
    }
    
    //component render
    <ReactFlagsSelect
    defaultCountry="US"
    onSelect={this.onSelectFlag} />

updateSelected

You can dynamically update the selected country on the component using updateSelected() method.

    //updateSelected Method
    this.refs.userFlag.updateSelected("UK")
    
    //component render
    <ReactFlagsSelect
    ref="userFlag"
    defaultCountry="US" />

License

MIT Licensed. Copyright (c) Richard Ekwonye 2017.