npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

no-style-password-field

v1.0.3

Published

This NPM package offers a versatile and unstyled TextField component for React applications, designed to provide all the functionality of a password field while leaving the styling completely up to you. With this component, you have the freedom to design

Downloads

10

Readme

No Style Password Field

This NPM package offers a versatile and unstyled TextField component for React applications, designed to provide all the functionality of a password field while leaving the styling completely up to you. With this component, you have the freedom to design the look and feel by exposing class names for various elements within the component.

Installation

You can easily install this package using npm or yarn:

npm install no-style-password-field
# OR
yarn add no-style-password-field

Usage

To utilize this package in your React application, follow these simple steps:

  • Import the component:
import TextField from 'no-style-password-field';
  • Use the TextField component in your JSX code:
<TextField
  // Props go here
/>

Props

The TextField component accepts the following props:

  • placeholder (optional): A string representing the placeholder text for the input field.

  • className (optional): A string representing additional CSS classes to be applied to the input field.

  • value (optional): A string representing the current value of the input field.

  • name (required): A string representing the name of the input field.

  • onChange (optional): A callback function that is invoked when the input field value changes.

  • style (optional): An object representing additional inline styles to be applied to the input field.

  • id (optional): A string representing the HTML id attribute of the input field.

  • errorMessageClassName (optional): A string representing the CSS class for styling the error message.

  • mainContainerClassName (optional): A string representing the CSS class for styling the main container of the component.

  • inputContainerClassName (optional): A string representing the CSS class for styling the input container.

  • onError (optional): A callback function that is invoked when validation fails, providing the error message.

  • length (optional): A number representing the minimum length for input validation. Default is 8 characters.

  • errors (optional): An object with custom error messages for specific validation rules. Each key in the object corresponds to a validation rule's key, and the associated value is a string representing the custom error message for that rule.

  • validations (optional): An array of TValidation objects, where each object defines a validation rule. These rules can include regular expressions or custom validation functions to ensure input validity.

Example

<TextField
  mainContainerClassName="custom-main-container"
  onChange={(event:any)=>console.log(event)}
  onError={(error:string)=>console.log(error)}
  // Other props go here
/>
<PasswordField 
  name="password"
  validations={[
    { key: "length", validation: (value: string) => value.length >= 8 }
  ]}
  errors={{
  length: `Password must be at least ${length ?? 8} characters long`
  }}
/>

Keep in mind when passing a new validation rule you need to pass a error message for it to be displayed.

Features

  • Password input functionality with a visibility toggle.
  • Fully customizable styling through class names.
  • Input validation based on length, lowercase, uppercase, numbers, and special characters.
  • Callback function for handling validation errors.