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

react-character-counter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-character-counter

A React Wrapper Component to display character counts against controllered input elements

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

react-character-counter

Installation

Package Manager

NPM
npm install react-character-counter --save

Basic Usage

This Component only works for controlled inputs

import CharacterCounter from 'react-character-counter'

state = {
  name: ''
}

<CharacterCounter value={this.state.name} maxLength={120} >
  <input type='text' maxLength={120}  value={this.state.name}>
</CharacterCounter>

Accepted Props are below
{
  value: String, Required
  maxLength: Number, Required
  wrapperStyle: Object, Optional
  characterCounterStyle: Object, Optional
  overrideStyle: Boolean, Optional
}
Adding more styles can be done as
<CharacterCounter
  value={this.state.name}
  maxLength={120}
  wrapperStyle={{position: 'relative'}}
  characterCounterStyle={{color: 'orange'}}
>
  <input type='text' maxLength={120}  value={this.state.name}>
</CharacterCounter>
Overriding existing Styling and positioning all together can be done as
<CharacterCounter
  value={this.state.name}
  maxLength={120}
  wrapperStyle={{position: 'relative'}}
  characterCounterStyle={{
    position: "absolute",
    fontSize: "12px",
    fontWeight: "600",
    top: "14px",
    right: "0px"
  }}
>
  <input type='text' maxLength={120}  value={this.state.name}>
</CharacterCounter>
Default Styling is listed below
Wrapper Style
{
  position: "relative"
}
Character Counter Style
{
  position: "absolute",
  fontSize: "12px",
  fontWeight: "600"
}

Keywords

FAQs

Package last updated on 25 Mar 2019

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