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

@batype/react-autosize-input

v0.0.3

Published

一个会根据输入内容自动调整宽度的输入框组件。

Readme

ReactAutoSizeInput

一个会根据输入内容自动调整宽度的输入框组件。

功能特性

  • 根据输入内容自动调整输入框宽度
  • 支持最小宽度设置
  • 支持自定义样式
  • 支持禁用状态
  • 支持placeholder
  • 支持失焦事件

安装

npm install @batype/react-autosize-input

使用示例

import ReactAutoSizeInput from '@batype/react-autosize-input';

function App() {
  const [value, setValue] = React.useState('');
  
  return (
    <ReactAutoSizeInput
      value={value}
      onChange={setValue}
      minWidth={10}
      placeholder="请输入"
    />
  );
}

API

| 参数 | 说明 | 类型 | 默认值 | | --- | --- | --- | --- | | value | 输入框内容 | string | - | | onChange | 输入内容变化时的回调函数 | (value: string) => void | - | | onBlur | 失焦时的回调函数 | (value: string) => void | - | | minWidth | 最小宽度(px) | number | 0 | | placeholder | 占位符 | string | - | | disabled | 是否禁用 | boolean | false | | inputClassName | 输入框的自定义类名 | string | - | | inputRef | 获取输入框 DOM 元素的引用函数 | (el: HTMLInputElement) => void | - |

样式自定义

组件默认提供了基础样式,你可以通过 inputClassName 传入自定义类名来覆盖默认样式。

注意事项

  1. 组件会自动根据内容调整宽度,但建议设置一个合适的 minWidth 来保证较好的用户体验
  2. 组件内部使用了一个隐藏的 span 元素来计算文本宽度,因此需要确保字体相关样式正确设置

License

MIT