New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

react-intl-input

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-intl-input

A react component to handle multi languages forms

latest
Source
npmnpm
Version
0.2.1
Version published
Weekly downloads
15
Maintainers
1
Weekly downloads
 
Created
Source

react-intl-input

A flexible input control for React to handle multi languages fields.

Travis npm package Coveralls

Installation

npm install --save react-intl-input

Then you can import one of react-intl-input components as follows:

import { IntlInput } from 'react-intl-input';

Features

  • Can be used standalone
  • Works with redux-form
  • Easy customization

Basic usage

import { IntlInput } from 'react-intl-input';

class Form extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      languages: [
       { value: 'en', label: 'English' },
       { value: 'fr', label: 'French' },
      ],
      initialValues: {
        en: 'This is an english translation',
        fr: 'Ceci est un texte en francais',
      },
    }
  }

  render() {
    return (
      <form onSubmit={() => {}}>
        <IntlInput
          name="basic-intl-input"
          {...this.state}
        />
      </form>
    )
  }
}

Demo & Examples

Live demo with many concrete examples: papswell.github.io/react-intl-input

Props

PropertyTypeDefaultDescription
namestring (required)The name attribute of the html input.
languagesarray (required)The languages handled by the input
initialLangstringThe language selected on the first render
initialValuesobjectThe initial values for each language
onLangChangefuncCalled whenever the language selection changes. onLangChange({ value, label}, state)
onInputChangefuncCalled whenever the current value changes. onInputChange(currentLanguage, inputValue, state)
onInputFocusfuncCalled when the input is focused. onInputFocus(syntheticEvent)
onInputBlurfuncCalled when the input is blurred. onInputChange(syntheticEvent)
inputComponentfuncA function or a React.Component to be used as the input.

Keywords

react-component

FAQs

Package last updated on 29 Dec 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts