Giter VIP home page Giter VIP logo

emoji-picker-textfields-component's Introduction

React Text field components with emoji picker

Greenkeeper badge

Live demo

Companion package to Emoji Picker React. Comes pre-integrated, and bundled with version 1.4.0 of the picker.

alt tag

npm i emoji-picker-textfield --save

Useage:

import React from 'react';
import EmojiField from 'emoji-picker-textfield';

function inputComponent(props) {
    // you need to explicitly pass 'fieldType="input"'.
    return <EmojiField name="my-input" onChange={props.onChange} fieldType="input"/>
}

function textAreaComponent(props) {
    // defaults to textarea, no need to pass fieldType
    return <EmojiField name="my-textarea" onChange={props.onChange}/>
}

Note on onChange:

When you onChange function fires, it has the following params (in order):

  • event | Event || null - the event triggered by the change. When triggered manually, is set to null
  • value | String - the actual value of the text field
onChange(e, value) { ... }

Getting the emoji values

The component exposes the following functions to get the unified value manually: getUnicode: Returns the field value with unicode emoji characters getImages: Returns the field value with html image tags representing the emojis

To gain access to these functions, you need to store the component as a ref:

<EmojiField ref={(_field) => this._field = _field}/>

Then, to call the function, you simply:

const unicodeValue = this._field.getUnicode();
const imagesValue = this._field.getImages();

Autoclosing the picker after choosing an emoji:

<EmojiField autoClose={true}/>

alt tag

alt tag

alt tag

alt tag

Attributions

You can use this picker, free of charge, no attribution is needed. The emojis have their own license.

All emoji images in this project are the property of the Emojione. Usage of the images is subjeced to their free license.

Other shout-outs:

  • iamcal/emoji-data An amazing project, containing emoji data. All the info (names, keywords, etc) in this picker is generated from their data.
  • throttle-debounce npm package, used multiple times in the project.
  • iconmonstr used for the category icons.
  • React Storybook, made building the live demo fast and simple.

emoji-picker-textfields-component's People

Contributors

ealush avatar greenkeeper[bot] avatar olegelantsev avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.