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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@xsolla/xui-input-copy

v0.106.0

Published

A cross-platform React input component that includes a copy-to-clipboard button. Supports visibility toggle for sensitive data like API keys or tokens.

Readme

Input Copy

A cross-platform React input component that includes a copy-to-clipboard button. Supports visibility toggle for sensitive data like API keys or tokens.

Installation

npm install @xsolla/xui-input-copy
# or
yarn add @xsolla/xui-input-copy

Demo

Basic Input Copy

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function BasicInputCopy() {
  return (
    <InputCopy
      value="sk_live_abc123xyz"
      onCopy={(val) => console.log('Copied:', val)}
    />
  );
}

With Label

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function LabeledInputCopy() {
  return (
    <InputCopy
      label="API Key"
      value="sk_live_abc123xyz789"
      onCopy={(val) => console.log('Copied:', val)}
    />
  );
}

Secure Text Entry

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function SecureInputCopy() {
  return (
    <InputCopy
      label="Secret Token"
      value="super_secret_token_12345"
      secureTextEntry={true}
      onCopy={(val) => console.log('Copied:', val)}
    />
  );
}

Editable Input Copy

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function EditableInputCopy() {
  const [value, setValue] = React.useState('editable-value');

  return (
    <InputCopy
      label="Editable Field"
      value={value}
      onChange={(e) => setValue(e.target.value)}
      onCopy={(val) => console.log('Copied:', val)}
    />
  );
}

Anatomy

import { InputCopy } from '@xsolla/xui-input-copy';

<InputCopy
  value="text to copy"         // Value to display and copy
  onChange={handleChange}      // Change event handler
  onCopy={handleCopy}          // Callback after copying
  secureTextEntry={false}      // Hide text like password
  initialVisible={false}       // Initial visibility (when secure)
  size="md"                     // Size variant
  label="Label"                // Label above input
  disabled={false}             // Disabled state
  error={false}                // Error state
  errorMessage="Error"         // Error message text
/>

Examples

Input Copy Sizes

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function InputCopySizes() {
  return (
    <div style={{ display: 'flex', flexDirection: 'column', gap: 16 }}>
      <InputCopy size="xs" value="Extra Small" />
      <InputCopy size="sm" value="Small" />
      <InputCopy size="md" value="Medium" />
      <InputCopy size="lg" value="Large" />
      <InputCopy size="xl" value="Extra Large" />
    </div>
  );
}

Error State

import * as React from 'react';
import { InputCopy } from '@xsolla/xui-input-copy';

export default function ErrorInputCopy() {
  return (
    <InputCopy
      label="API Key"
      value="invalid-key"
      error={true}
      errorMessage="Invalid API key format"
    />
  );
}

API Reference

InputCopy

InputCopy Props:

| Prop | Type | Default | Description | | :--- | :--- | :------ | :---------- | | value | string | "" | Value to display and copy. | | onChange | (e: ChangeEvent) => void | - | Change event handler. | | onChangeText | (text: string) => void | - | Text change handler. | | onCopy | (value: string) => void | - | Callback when value is copied. | | secureTextEntry | boolean | false | Hide text like a password field. | | initialVisible | boolean | false | Initial visibility when secureTextEntry is true. | | size | "xl" \| "lg" \| "md" \| "sm" \| "xs" | "md" | Component size. | | label | string | - | Label above input. | | disabled | boolean | false | Disabled state. | | error | boolean | false | Error state. | | errorMessage | string | - | Error message text. | | placeholder | string | - | Placeholder text. | | testID | string | - | Test identifier. |

Behavior

  • Copy Button: Shows checkmark icon briefly (2 seconds) after successful copy
  • Visibility Toggle: When secureTextEntry is enabled, the eye icon reflects the current state:
    • Open eye (👁️) = Text is currently visible (type="text")
    • Closed eye (🙈) = Text is currently hidden (type="password")
    • This follows modern design system conventions (Material, Apple, Atlassian, Polaris)
  • Uses browser Clipboard API for copying
  • Error state shows red border and error message

Accessibility

  • Copy button has aria-label that changes from "Copy to clipboard" to "Copied" after action
  • Visibility toggle button has appropriate aria-label:
    • "Show text" when text is hidden
    • "Hide text" when text is visible
  • Toggle button uses aria-pressed to indicate current visibility state
  • Error messages linked via aria-describedby for screen reader context
  • Labels properly linked via aria-labelledby when provided
  • Input has aria-invalid when in error state
  • Error messages use role="alert" for immediate announcement