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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@metadiv-studio/input

v0.3.2

Published

A modern, accessible React input component with enhanced functionality and beautiful styling. Built with TypeScript, Tailwind CSS, and designed for seamless integration into your React applications.

Readme

@metadiv-studio/input

A modern, accessible React input component with enhanced functionality and beautiful styling. Built with TypeScript, Tailwind CSS, and designed for seamless integration into your React applications.

📦 Installation

npm i @metadiv-studio/input

✨ Features

  • Multiple Input Types: Text, email, password, number, dollar (cents), time, and color
  • Enhanced Password Input: Built-in show/hide password toggle with eye icons
  • Smart Dollar Input: Automatically formats currency values and handles cents
  • Number Validation: Clean number-only input with proper formatting
  • Accessibility: Full keyboard navigation and screen reader support
  • Dark Mode Ready: Built-in dark mode support with CSS variables
  • Customizable: Extensible styling with Tailwind CSS classes
  • TypeScript: Full type safety with comprehensive prop interfaces

🚀 Quick Start

import { Input } from '@metadiv-studio/input';

function MyForm() {
  return (
    <Input
      type="text"
      placeholder="Enter your name"
      className="max-w-md"
    />
  );
}

📚 Usage Examples

Basic Text Input

import { Input } from '@metadiv-studio/input';

<Input
  type="text"
  placeholder="Enter your name"
  value={name}
  onChange={(e) => setName(e.target.value)}
/>

Email Input

<Input
  type="email"
  placeholder="Enter your email"
  value={email}
  onChange={(e) => setEmail(e.target.value)}
/>

Password Input with Toggle

The password input automatically includes a show/hide toggle button:

<Input
  type="password"
  placeholder="Enter your password"
  value={password}
  onChange={(e) => setPassword(e.target.value)}
/>

Number Input

Automatically filters non-numeric characters and provides clean number handling:

<Input
  type="number"
  placeholder="Enter a number"
  value={number}
  onChange={(e) => setNumber(e.target.value)}
/>

Dollar Input (Cents)

Special input type that handles currency values in cents and displays formatted dollar amounts:

<Input
  type="dollar"
  placeholder="Enter amount in cents"
  value={amount}
  onChange={(e) => setAmount(e.target.value)}
/>
// Input: 1250 → Display: $12.50
// Input: 100 → Display: $1.00

Time Input

<Input
  type="time"
  value={time}
  onChange={(e) => setTime(e.target.value)}
/>

Color Input

<Input
  type="color"
  value={color}
  onChange={(e) => setColor(e.target.value)}
/>

Disabled State

<Input
  type="text"
  placeholder="This input is disabled"
  disabled
/>

Custom Styling

<Input
  type="text"
  placeholder="Custom styled input"
  className="max-w-md border-2 border-blue-500 focus:border-blue-700 bg-blue-50 dark:bg-blue-900/20"
/>

🎨 Props

The Input component extends all standard HTML input attributes and includes:

interface InputProps extends React.InputHTMLAttributes<HTMLInputElement> {
  type?: 'text' | 'password' | 'email' | 'number' | 'dollar' | 'time' | 'color';
  // ... all standard HTML input props
}

Common Props

  • type: Input type (defaults to 'text')
  • value: Controlled input value
  • onChange: Change event handler
  • placeholder: Placeholder text
  • disabled: Disabled state
  • className: Additional CSS classes for customization

🎯 Advanced Features

Dollar Input Behavior

The dollar input type automatically:

  • Converts user input to cents (stored as numbers)
  • Displays formatted currency (e.g., "$12.50")
  • Handles edge cases and validation
  • Provides clean numeric values to your form handlers

Password Input Features

  • Built-in show/hide toggle button
  • Eye and eye-off icons from Lucide React
  • Proper accessibility labels
  • Smooth transitions

Number Input Validation

  • Filters non-numeric characters
  • Handles negative numbers
  • Provides clean numeric output
  • Maintains proper number formatting

🎨 Styling

The component uses Tailwind CSS with a clean, modern design that includes:

  • Responsive design
  • Dark mode support
  • Focus states with ring indicators
  • Hover effects
  • Disabled state styling
  • Customizable borders and backgrounds

CSS Variables

The component uses CSS custom properties for theming:

:root {
  --ring: hsl(var(--primary));
  --muted-foreground: hsl(var(--muted-foreground));
  --foreground: hsl(var(--foreground));
}

🔧 Requirements

  • React 18+
  • Tailwind CSS 3.4+
  • TypeScript (recommended)

📦 Dependencies

  • @metadiv-studio/button: For internal button components
  • lucide-react: For icons
  • clsx: For conditional class names

🚀 Development

To run the development environment:

npm run dev

To build for production:

npm run build

📄 License

This package is part of the MetaDiv Studio component library.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Built with ❤️ by MetaDiv Studio