Socket
Socket
Sign inDemoInstall

@kitsuyui/react-textfield

Package Overview
Dependencies
5
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @kitsuyui/react-textfield

A component that wrapped HTMLInputElement


Version published
Weekly downloads
5
increased by150%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

@kitsuyui/react-textfield

npm version

This package provides a text field component for React.

It is very pure and similar with the default <input type="text"> element and <textarea> element.

So you can pass the same props as those elements. (i.e. disabled, placeholder, maxLength, minLength, required, pattern, readOnly, autoComplete, autoFocus, name, id, className, style, ..., etc.) This means, you can use this component as a drop-in replacement for those elements.

The big difference is that this component how to handle the events. In default browser elements (<input type="text"> and <textarea>), the onChange event is fired in every key press. But when you are using IME or something special input method, the onChange event is fired in every key press even if the input is not completed or text conversion is not completed. (e.g. Japanese IME, Chinese IME, espanso, etc.) This component calls the onInput handler (text: string) => void only when the input is completed or text conversion is completed. (Internally, it uses CompositionEvent to detect the completion of input or text conversion)

Warning: This component has no effect to prevent the re-rendering of parent component. This means, if this component is re-created by parent component, the input may lost text conversion state.

Demo

Storybook: https://react-playground.docs.kitsuyui.com/storybook/

Installation

npm

npm install @kitsuyui/react-textfield

yarn

yarn add @kitsuyui/react-textfield

pnpm

pnpm add @kitsuyui/react-textfield

Reference

License

MIT

FAQs

Last updated on 29 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc