Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-input-placeholder

Package Overview
Dependencies
Maintainers
3
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-input-placeholder

Input and Textarea React components with polyfilled placeholder support.

  • 1.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
498
increased by5.51%
Maintainers
3
Weekly downloads
 
Created
Source

React Input and Textarea with Placeholder Shim

PlaceholderShim provides Input and Textarea, small wrappers around React.createElement('input') and React.createElement('textarea') respectively that shims in placeholder functionality for browsers that don't natively support it. Currently only tested with IE9.

Demo: https://jsfiddle.net/69z2wepo/16498/

Getting Started

Browserify

Install: npm install react-input-placeholder

Require:

Input = require('react-input-placeholder')(React).Input;
Textarea = require('react-input-placeholder')(React).Textarea;

No module

The compiled bundle sits in the dist/ folder.

<script src='dist/react-input-placeholder.min.js'></script>
<script>
  var Input = PlaceholderShim.Input;
  var Textarea = PlaceholderShim.Textarea;
</script>

Usage

You can use Input or Textarea exactly the same way you'd use React.createElement('input') or <input /> in JSX. All attributes will be passed on, and all event callbacks will be called. However, please note that the placeholder shim only works on controlled inputs (i.e., you must provide a value or valueLink prop).

When the placeholder text is visible, the placeholder CSS class will be added to the input element so you can style it, e.g.

input.placeholder,
textarea.placeholder {
  color: gray;
  font-style: italic;
}

Before

Placeholder doesn't show on IE9.

<input placeholder="Enter text here..." value={this.state.value} onChange={this.handleChange} />

After

Works on IE9!

<Input placeholder="Enter text here..." value={this.state.value} onChange={this.handleChange} />

Building yourself

npm install
grunt dist

License

MIT

Keywords

FAQs

Package last updated on 21 Sep 2015

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc