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

abaabil.select

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

abaabil.select

  • 0.0.6
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-33.33%
Maintainers
0
Weekly downloads
 
Created
Source

Input Component

The Input component is a customizable and accessible input field designed for React applications. This component is part of the abaabil.input package and supports various input types with flexible styling and accessibility features.

Installation

To install the Input component, use npm or yarn:

npm install abaabil.input

or

yarn add abaabil.input

Usage

After installation, you can import and use the Input component in your React project as follows:

import Input from 'abaabil.input';

function App() {
  return (
    <div>
      <Input label="Your Name" placeholder="Enter your name" />
    </div>
  );
}

export default App;

Disabled State Example

You can disable the Input component to make it non-interactive:

import Input from 'abaabil.input';

function App() {
  return (
    <div>
      <Input label="Disabled Input" placeholder="Cannot type here..." disabled />
    </div>
  );
}

export default App;

Properties

The Input component accepts several properties to customize its behavior and appearance:

PropertyTypeDefaultDescription
typestring'text'The type of input field. Available types include text, password, email, search, number, date, time, and datetime-local.
labelstring''The label for the input field.
valuestring''The controlled value of the input field.
containerClassNamestring''Additional CSS classes to apply to the outer container wrapping the entire input field.
labelClassNamestring''Additional CSS classes to apply to the label element.
inputClassNamestring''Additional CSS classes to apply to the input element itself.
disabledbooleanfalseDisables the input field if set to true.
ariaLabelstring''Defines a string value that labels the input field.
ariaDescribedBystring''Identifies the element that describes the input field.
ariaRequiredbooleanfalseIndicates whether the input field is required.
onChangefunctionnullCallback function that triggers when the input value changes.

Input Types

The Input component supports the following types:

  • text - Text Input
  • password - Password Input
  • email - Email Input
  • search - Search Input
  • number - Number Input
  • date - Date Picker
  • time - Time Picker
  • datetime-local - Date-Time Picker

Example Usage with Different Input Types

import Input from 'abaabil.input';

function App() {
  return (
    <div className="space-y-4">
      <Input label="Text Input" placeholder="Type here..." />
      <Input label="Password Input" type="password" placeholder="Password" />
      <Input label="Email Input" type="email" placeholder="Email" />
      <Input label="Search Input" type="search" placeholder="Search" />
      <Input label="Number Input" type="number" placeholder="Number" />
      <Input label="Date Picker" type="date" />
      <Input label="Time Picker" type="time" />
      <Input label="Date-Time Picker" type="datetime-local" />
    </div>
  );
}

export default App;

Customizing the Component

You can customize the Input component using the containerClassName, labelClassName, and inputClassName properties to apply your custom styles.

<Input
  label="Custom Styled Input"
  placeholder="Enter something..."
  containerClassName="mb-4"
  labelClassName="text-lg font-bold"
  inputClassName="border-gray-300 rounded"
/>

Accessibility

The Input component includes several accessibility properties such as ariaLabel, ariaDescribedBy, and ariaRequired to enhance the usability of the input fields for all users.

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Summary of README.md Content:

  • Installation: Instructions for installing the Input component.
  • Usage: Basic usage examples, including an example of a disabled state.
  • Properties: A table describing the properties that can be passed to the component.
  • Input Types: A list of supported input types with an example usage.
  • Customization: Guidance on how to apply custom styles.
  • Accessibility: Highlights the accessibility features of the component.
  • License: Indicates that the project is licensed under the MIT License.

Keywords

FAQs

Package last updated on 23 Aug 2024

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