1.0.11 • Published 9 months ago

react-placeholder-typing v1.0.11

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Demo

Demo GIF

react-placeholder-typing

The react-placeholder-typing is a customizable React component that displays an animated typing and deleting effect for placeholder text within an input field. The placeholders cycle through a list of specified strings, creating a typewriter or keyboard typing animation. The component accepts an icon and font family as customizable props, making it flexible for use in various projects and styles. Ideal for enhancing user interface and experience in projects where input fields are used."

NPM JavaScript Style Guide

Install

npm install --save react-placeholder-typing

or with yarn

yarn add react-placeholder-typing

Usage

import React, { Component, useState } from 'react'
import LanguageIcon from "@mui/icons-material/Language";
import ReactPlaceholderTyping from 'react-placeholder-typing'

const Example = () => {
  const placeholders = ['https://dubsub.ai', 'https://producthunt.com', 'https://www.indiehackers.com'];
  const [website, setWebsite] = useState('');

  return <ReactPlaceholderTyping
      placeholders={placeholders}
      value={website}
      onChange={(value) => {
        setWebsite(value)
      }}
      fontFamily={'Roboto'}
      renderIcon={() => (<LanguageIcon style={{color: '#f5f5f5'}}/>)}
    />
}

...

Props

PropertyTypeDefaultDescription
placeholdersarray[]An array of placeholder texts to display in the typing animation.
valuestring""The current input value.
onChangefunctionnullCallback function that is called when the input value changes.
fontFamilystring"Arial"The font family for the input field.
renderIconfunctionnullA function that returns a JSX element to be used as the input icon.
containerStyleobject{}style of the container if you want to modify the wrapper styles
inputStyleobject{}style of the input element if you want to modify the inputbox styles

License

MIT © pashanitw

License

MIT © pashanitw