跳转到内容
文档

文档Inputs

Inputs

每个字段都有用途,为它选择合适的输入组件。

@rentnerkev/inputs文档对应版本: v2.8.2

安装包

请使用 React 19,并在应用的全局 CSS 中导入一次包的样式表。附带的样式基于 Tailwind CSS 4。

Terminal
bun add @rentnerkev/inputs
全局样式表 / styles.css
@import '@rentnerkev/inputs/tailwind.css';

Inputs 2.8.2:原生数值边界#

NumberInput 和 QuantityInput 会优先解析原生 min/max,再考虑对应的 minValue/maxValue 别名,也接受数字字符串。省略某个原生边界时会使用其别名;显式传入空值或非有限的原生边界则会清除该边界,而不会回退到别名。常规表单应使用有限的数值边界。内置验证和编辑时的最大值保护均使用解析后的边界。QuantityInput 的值仍是整数字符串,后缀仅用于显示。

example.tsx
import { useState } from 'react'
import { NumberInput, QuantityInput } from '@rentnerkev/inputs'

export default function NativeBounds() {
    const [amount, setAmount] = useState('5')
    const [pieces, setPieces] = useState('3')
    return (
        <>
            <NumberInput
                label="Amount: 2 to 10"
                locale="en"
                min={2}
                max={10}
                minValue={0}
                maxValue={100}
                value={amount}
                onValueChange={setAmount}
            />
            <QuantityInput
                label="Pieces: 1 to 12"
                locale="en"
                min="1"
                max="12"
                suffix=" pieces"
                value={pieces}
                onValueChange={setPieces}
            />
        </>
    )
}

NumericInput#

2.8.0 新增:NumericInput 的受控值为 number | null,而不是字符串。空值、符号和小数草稿可继续编辑,失焦或按 Enter 时提交有限十进制数;支持小数逗号,清空时提交 null。不完整草稿、指数、十六进制和无穷值会恢复为受控值。原生 min/max 只报告错误,不截断数值。NumberInput、MoneyInput 和 QuantityInput 保留现有字符串 API。

example.tsx
import { NumericInput } from '@rentnerkev/inputs/numeric-input'
import { useState } from 'react'

export default function Amount() {
    const [amount, setAmount] = useState<number | null>(null)
    return (
        <NumericInput
            controlSize="md"
            description="Blur or press Enter to commit; clear for null"
            label="Amount"
            min={0}
            name="amount"
            onValueChange={setAmount}
            value={amount}
        />
    )
}

字段尺寸、插槽与时间 portal#

2.8.0 新增:在 InputProvider 或字段上通过 controlSize 选择 sm/md/lg(36/44/48 px);省略时保持原有尺寸,显式尺寸也适用于文本域。classNames 合并 Provider 与局部的 root、label、description、error、wrapper、control、leading、trailing、counter 及现有控件专用插槽。新的 control 插槽替换默认视觉样式;旧的 className/input/textarea 仍保留 customDesign。原生复选框、单选框、滑块和文件控件没有字段外壳。TimeInput 继承 portalContainer、portalClassName 和 portalZIndex;null 使用 document.body。

example.tsx
import { InputProvider, TimeInput } from '@rentnerkev/inputs'
import { useState } from 'react'

export default function TimeField() {
    const [time, setTime] = useState('09:00')
    return (
        <InputProvider
            controlSize="md"
            classNames={{ label: 'font-semibold' }}
            portalZIndex={12000}
        >
            <TimeInput
                classNames={{
                    control:
                        'rounded-lg border border-slate-500 bg-white px-3 text-slate-900',
                }}
                controlSize="lg"
                label="Start time"
                onValueChange={setTime}
                value={time}
            />
        </InputProvider>
    )
}

不依赖 UI 的表单适配器#

/form 中的 getInputFieldProps 连接 name、直接值变更、失焦和外部错误,无需表单库运行时依赖。应在订阅字段状态的渲染中传入包含 state.value、可选 meta.errors/isTouched、handleChange 和 handleBlur 的结构化字段。错误默认在触碰后显示,可通过 showErrors 和 mapError 调整。validationMode 为 external,required 仍保留必填语义。适配器也会为 NumericInput 保留 number | null 类型。

example.tsx
import { NumericInput } from '@rentnerkev/inputs'
import { getInputFieldProps } from '@rentnerkev/inputs/form'
import type { FieldAdapter } from '@rentnerkev/inputs/form'

export default function AmountField({
    field,
}: {
    field: FieldAdapter<number | null>
}) {
    return (
        <NumericInput
            {...getInputFieldProps(field, { showErrors: 'touched' })}
            label="Amount"
            required
        />
    )
}

表单错误辅助函数#

不依赖 UI 的 /form 入口导出 getFieldError 和 mapFieldError。getFieldError 默认在字段被触碰后返回第一个可读错误;showErrors 支持 touched、always 或 never,mapError 可处理应用自定义错误。mapFieldError 接受字符串或带有字符串 message 的对象,其他情况返回 null。辅助函数只读取传入的字段快照;状态变化时应在订阅字段状态的渲染中重新调用。

example.ts
import { getFieldError, mapFieldError } from '@rentnerkev/inputs/form'
import type { FieldAdapter } from '@rentnerkev/inputs/form'

export function readError<T>(field: FieldAdapter<T>) {
    return getFieldError(field, {
        showErrors: 'always',
        mapError: (error) => mapFieldError(error),
    })
}

export const message = mapFieldError({ message: 'Please check this field' })

共享主题变量#

所有包共享 --rentner-* CSS 变量,包括 control、surface、foreground、muted、border、accent、accent-hover、accent-foreground、danger、success、warning、info 和 radius。Tailwind 入口会自动引入 theme.css;单独导出的 theme.css 仅包含主题变量,不包含完整的组件样式。全局主题可在 :root 上设置变量。局部主题还必须覆盖实际的 portal 目标。现有 customDesign 和旧主题变量仍受支持。

styles.css
@import 'tailwindcss';
@import '@rentnerkev/inputs/tailwind.css';

:root {
    --rentner-control: #ffffff;
    --rentner-surface: #f8fafc;
    --rentner-foreground: #0f172a;
    --rentner-muted: #475569;
    --rentner-border: #64748b;
    --rentner-accent: #0369a1;
    --rentner-accent-hover: #075985;
    --rentner-accent-foreground: #ffffff;
    --rentner-danger: #be123c;
    --rentner-success: #047857;
    --rentner-warning: #b45309;
    --rentner-info: #0369a1;
    --rentner-radius: 0.5rem;
}

本地 AI 辅助函数:元数据与指南#

在本地 Node.js 或 Bun 脚本中导入 /ai 入口。这些同步只读辅助函数通过 node:fs 读取已安装的软件包,无需导入其 UI。getPackageInfo() 返回 PackageInfo,包含已安装版本、公共导出和对等依赖。getPackageDocumentation() 返回带有 path 和 content 的 PackageDocument;默认值为 usage,readme 选择 README.md。仅接受这两个随包提供的文档。结果描述的是本地安装版本,可能与本网站不同。

inspect-package.ts · Node.js / Bun
import { getPackageDocumentation, getPackageInfo } from '@rentnerkev/inputs/ai'
import type { PackageDocument, PackageInfo } from '@rentnerkev/inputs/ai'

const info: PackageInfo = getPackageInfo()
const usage: PackageDocument = getPackageDocumentation()
const readme = getPackageDocumentation('readme')

console.log(info.name, info.version, info.exports, info.peerDependencies)
console.log(usage.path, usage.content)
console.log(readme.path, readme.content)

本地 AI 辅助函数:公共声明#

getPackageApi() 返回 PackageApi,包含 package、已安装的 version、选定的 subpaths 和由 PackageDocument 对象组成的 declarations。它读取带类型声明的公共入口及其本地声明依赖;不包含 /ai 本身。使用 . 或 ./types 等 subpath 选择公共入口。symbol 验证该入口是否导出指定名称;不会将声明文件裁剪为仅含该符号的内容。未知子路径、无效名称或选定入口未导出的名称会抛出错误。调用方不能提供任意文件路径。

inspect-api.ts · Node.js / Bun
import { getPackageApi } from '@rentnerkev/inputs/ai'
import type { PackageApi } from '@rentnerkev/inputs/ai'

const api: PackageApi = getPackageApi()
const selected = getPackageApi({ subpath: '.', symbol: 'CustomInput' })

console.log(api.package, api.version, api.subpaths)
for (const declaration of selected.declarations) {
    console.log(declaration.path, declaration.content)
}

本地 AI 辅助函数:搜索与示例#

searchPackageDocumentation(query) 去除查询两端空白后,以不区分大小写的字面文本搜索 README.md 和 docs/usage.md。它返回 PackageSearchMatch 对象,包含 path、从一开始的 line 行号和匹配的 text;空查询返回空数组。getPackageExamples() 将已安装使用指南中的每个围栏代码块返回为含 language 和 code 的 PackageExample。这些辅助函数为你自己的工具提供文本,不会执行示例或联系 AI 服务。

search-package.ts · Node.js / Bun
import { getPackageExamples, searchPackageDocumentation } from '@rentnerkev/inputs/ai'
import type { PackageExample, PackageSearchMatch } from '@rentnerkev/inputs/ai'

const matches: PackageSearchMatch[] = searchPackageDocumentation('CustomInput')
const examples: PackageExample[] = getPackageExamples()

for (const match of matches) {
    console.log(match.path, match.line, match.text)
}
for (const example of examples) {
    console.log(example.language, example.code)
}

CustomInput#

通过 type 动态选择输入:text、search、number、phone、email、money、password、quantity、time、native-time 或 textarea。该分发组件与专用组件共享受控值、验证及样式属性。数值也以字符串表示,可使用 onValueChange 或基于事件的 onChange 接口。

example.tsx
import { useState } from 'react'
import { CustomInput } from '@rentnerkev/inputs'

export default function DynamicField() {
    const [value, setValue] = useState('')
    return (
        <CustomInput
            label="Email"
            onValueChange={setValue}
            type="email"
            value={value}
        />
    )
}

TextInput#

单行文本字段,可显示长度信息。minLength 和 maxLength 设置长度限制,showLength 显示计数器。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { TextInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <TextInput
            id="example-field"
            label="Text"
            locale="en"
            onValueChange={setValue}
            value={value}
            maxLength={80}
            showLength
        />
    )
}

SearchInput#

适用于筛选或搜索词的原生搜索字段。组件负责输入,应用决定搜索内容及触发时机。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { SearchInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <SearchInput
            id="example-field"
            label="Search"
            locale="en"
            onValueChange={setValue}
            value={value}
            placeholder="Search packages"
        />
    )
}

EmailInput#

内置格式验证的电子邮件字段。显示服务器验证结果时可结合 required 与 error。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { EmailInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <EmailInput
            id="example-field"
            label="Email"
            locale="en"
            onValueChange={setValue}
            value={value}
            placeholder="[email protected]"
            required
        />
    )
}

NumberInput#

带有原生 min/max 约束及旧版 minValue/maxValue 别名的数值字段,原生边界优先。编辑时会拒绝超过实际最大值的值;最小值参与验证。回调返回字符串并保留空输入,提交表单时再进行转换。这是一个受控字段:value 为字符串,onValueChange 接收下一个字符串。通用属性包括 label、description、required、disabled、readOnly、error 以及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { NumberInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <NumberInput
            id="example-field"
            label="Number"
            locale="en"
            onValueChange={setValue}
            value={value}
            maxValue={100}
            minValue={0}
        />
    )
}

MoneyInput#

以文本接收金额,并在失焦时使用 Intl.NumberFormat 格式化。currency 是 ISO 货币代码,默认值为 EUR;locale 控制小数和分组格式。请将可编辑值保留为文本。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { MoneyInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <MoneyInput
            id="example-field"
            label="Money"
            locale="en"
            onValueChange={setValue}
            value={value}
            currency="EUR"
        />
    )
}

PasswordInput#

提供显示、隐藏控制的密码字段,可通过 showPasswordStrength 显示密码强度反馈。该反馈帮助用户选择密码,但密码策略仍由服务器决定。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { PasswordInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <PasswordInput
            id="example-field"
            label="Password"
            locale="en"
            onValueChange={setValue}
            value={value}
            autoComplete="new-password"
            showPasswordStrength
        />
    )
}

PhoneInput#

采用保守格式验证的电话号码字段。非空值在可选的 + 之后必须以数字或左括号开头,可包含数字、成对括号、空白、点、斜杠和连字符,并且至少包含一位数字。可选字段的空值仍然有效。它会保留输入的字符串,不负责格式化、推断国家或验证号码是否真实存在。这是一个受控字段:value 为字符串,onValueChange 接收下一个字符串。通用属性包括 label、description、required、disabled、readOnly、error 以及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { PhoneInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <PhoneInput
            id="example-field"
            label="Phone"
            locale="en"
            onValueChange={setValue}
            value={value}
            placeholder="+49 170 1234567"
        />
    )
}

QuantityInput#

数量字段支持 minValue、maxValue 及 kg、件等可选后缀。后缀只用于展示,受控值仍为输入的字符串。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { QuantityInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <QuantityInput
            id="example-field"
            label="Quantity"
            locale="en"
            onValueChange={setValue}
            value={value}
            maxValue={50}
            minValue={0}
            suffix="kg"
        />
    )
}

TimeInput#

使用时间字符串的自定义时、分选择器。minuteStep 设置分钟间隔。triggerRef 指向按钮而不是文本字段;如需浏览器自带的时间编辑器,请使用 NativeTimeInput。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { TimeInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <TimeInput
            id="example-field"
            label="Time"
            locale="en"
            onValueChange={setValue}
            value={value}
            minuteStep={15}
        />
    )
}

NativeTimeInput#

使用浏览器原生时间输入控件。标准属性 min、max 和 step 限制可选时间,step 以秒计。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { NativeTimeInput } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <NativeTimeInput
            id="example-field"
            label="NativeTime"
            locale="en"
            onValueChange={setValue}
            value={value}
            max="18:00"
            min="08:00"
            step={900}
        />
    )
}

Textarea#

多行文本区域。rows 控制初始高度,wrap 控制换行;maxLength 和 showLength 可用于显示字符限制。这是受控字段:value 为字符串,onValueChange 接收下一次输入的字符串。通用属性包括 label、description、required、disabled、readOnly、error 及常规 HTML 输入属性。

example.tsx
import { useState } from 'react'
import { Textarea } from '@rentnerkev/inputs'

export default function Field() {
    const [value, setValue] = useState('')

    return (
        <Textarea
            id="example-field"
            label="Textarea"
            locale="en"
            onValueChange={setValue}
            value={value}
            maxLength={500}
            rows={4}
            showLength
        />
    )
}

OtpInput#

在受控数组中为每一位使用一个字符串。length 设置输入格数量;onValueChange 更新数组,onComplete 以字符串形式接收完整验证码。组件会处理键盘移动和粘贴的验证码。status 支持 idle、error 或 success;animated、showProgress 和 feedbackClassNames 可自定义验证反馈。请将验证码发送到你自己的验证接口。

example.tsx
import { useState } from 'react'
import { OtpInput } from '@rentnerkev/inputs'

export default function VerificationCode() {
    const [digits, setDigits] = useState<string[]>(Array(6).fill(''))

    return (
        <OtpInput
            label="Verification code"
            length={6}
            onComplete={(code) => console.log('Verify', code)}
            onValueChange={setDigits}
            showProgress
            status="idle"
            value={digits}
        />
    )
}

CheckboxInput#

带样式的原生复选框,支持常规 checked、onChange、name、value、required 和 ref 属性。通过 event.target.checked 读取布尔状态。使用 id 关联可见的 HTML 标签;此基础控件不使用文本输入框的 label 属性。

example.tsx
import { useState } from 'react'
import { CheckboxInput } from '@rentnerkev/inputs'

export default function Consent() {
    const [checked, setChecked] = useState(false)
    return (
        <label htmlFor="consent">
            <CheckboxInput
                checked={checked}
                id="consent"
                onChange={(event) => setChecked(event.target.checked)}
            />
            Receive delivery updates
        </label>
    )
}

RadioInput#

原生单选控件。为同组单选项设置相同的 name、不同的 value 以及关联标签,并分别管理 checked。使用 fieldset 和 legend 为整个分组命名。

example.tsx
import { useState } from 'react'
import { RadioInput } from '@rentnerkev/inputs'

export default function Delivery() {
    const [value, setValue] = useState('standard')
    return (
        <fieldset>
            <legend>Delivery</legend>
            {['standard', 'express'].map((option) => (
                <label key={option}>
                    <RadioInput
                        checked={value === option}
                        name="delivery"
                        onChange={() => setValue(option)}
                        value={option}
                    />
                    {option}
                </label>
            ))}
        </fieldset>
    )
}

RangeInput#

支持 min、max 和 step 的原生滑块。当状态为数值时,可从变更事件读取 valueAsNumber。请提供标签,并在控件旁显示当前值。

example.tsx
import { useState } from 'react'
import { RangeInput } from '@rentnerkev/inputs'

export default function Volume() {
    const [value, setValue] = useState(50)
    return (
        <label>
            Volume: {value}
            <RangeInput
                max={100}
                min={0}
                onChange={(event) => setValue(event.target.valueAsNumber)}
                step={5}
                value={value}
            />
        </label>
    )
}

FileInput#

原生文件选择器。通过 accept 和 multiple 引导选择,再读取 event.target.files。请保持文件输入框为非受控状态:浏览器不允许将文件名赋给 value。组件负责选择文件,上传和内容校验由你的应用处理。

example.tsx
import { FileInput } from '@rentnerkev/inputs'

export default function Attachment() {
    return (
        <label>
            Attachments
            <FileInput
                accept="image/*"
                multiple
                onChange={(event) => console.log(event.target.files)}
            />
        </label>
    )
}

InputProvider#

统一设置 locale、messages、customDesign、validationMode 和 classNames。classNames 分别提供 input、textarea、checkbox、radio、range、file 和 otp 插槽。组件自身的属性优先于 Provider 默认值。基础控件支持常规原生属性,并继承 Provider 中对应的样式类插槽。

example.tsx
import { InputProvider, TextInput } from '@rentnerkev/inputs'
import { useState } from 'react'

export default function Form() {
    const [name, setName] = useState('')
    return (
        <InputProvider classNames={{ input: 'rounded-none' }} locale="en">
            <TextInput label="Name" onValueChange={setName} value={name} />
        </InputProvider>
    )
}

验证、错误与表单集成#

built-in 使用包内置的验证规则。external 允许表单库或你的应用提供错误消息。name 用于原生 FormData,id/label 提供可访问的字段名称,description 提供辅助说明。required、minLength 以及数值 minValue/maxValue 定义约束。triggerRef 可通过代码聚焦字段;专用文本输入组件也会转发其原生 ref。

example.tsx
import { useState } from 'react'
import { EmailInput } from '@rentnerkev/inputs'

export default function ExternalValidation() {
    const [email, setEmail] = useState('')
    return (
        <EmailInput
            description="We send delivery updates here"
            error={
                email && !email.includes('@') ? 'Enter an email address' : null
            }
            id="contact-email"
            label="Email"
            name="email"
            onValueChange={setEmail}
            required
            validationMode="external"
            value={email}
        />
    )
}

基于事件的 onChange#

文本字段也支持传统的 React 变更事件接口。使用 onChange 读取 event.target.value,或通过 onValueChange 直接接收字符串。checkbox、radio、range 和 file 基础控件使用原生 onChange,而非 onValueChange。

example.tsx
import { useState } from 'react'
import { TextInput } from '@rentnerkev/inputs'

export default function EventField() {
    const [value, setValue] = useState('')
    return (
        <TextInput
            label="Name"
            onChange={(event) => setValue(event.target.value)}
            value={value}
        />
    )
}

消息与国际化语言#

inputMessageCatalog 包含 de、en、es 和 fr。resolveInputMessages 将部分消息覆盖项与语言目录合并;函数型消息接收限制值或验证码位置。resolveInputIntlLocale 将短语言代码映射到 Intl 语言标识,并保留自定义语言字符串。将 locale 和 messages 传给字段或 InputProvider。你自己的标签和占位文本需要单独翻译。

example.ts
import {
    inputMessageCatalog,
    resolveInputIntlLocale,
    resolveInputMessages,
} from '@rentnerkev/inputs'

export const messages = resolveInputMessages('en', {
    required: 'Please fill out this field',
    minLength: (minimum) => 'Use at least ' + minimum + ' characters',
    invalidEmail: inputMessageCatalog.en.invalidEmail,
})
export const intlLocale = resolveInputIntlLocale('en')

自定义设计与验证码反馈#

CustomDesign 覆盖字段背景、边框、文本、标签、占位文本、焦点与错误状态,以及图标和计数器。密码强度提供独立的进度条、文本和 weak/fair/good/strong 插槽。验证码组件还支持 inputClassName,以及 filled、focus、error、success、progress 和 animation 状态的 feedbackClassNames。未指定的插槽使用包默认样式。

example.tsx
import { useState } from 'react'
import { TextInput } from '@rentnerkev/inputs'
import type { CustomDesign } from '@rentnerkev/inputs/types'

const design: CustomDesign = {
    bg: 'bg-amber-50',
    border: 'border-amber-700',
    text: 'text-stone-900',
    labelText: 'text-stone-800',
    focusBorder: 'focus:border-sky-600',
    errorText: 'text-red-700',
}

export default function StyledField() {
    const [value, setValue] = useState('')
    return (
        <TextInput
            customDesign={design}
            label="Name"
            onValueChange={setValue}
            value={value}
        />
    )
}

面向 AI 工具的文档

连接兼容的 MCP 客户端即可读取软件包 API、指南和示例。公开访问,无需账户或 API 密钥。

远程访问是可选的:请自行将此公共 URL 添加到 MCP 客户端。连接使用 Streamable HTTP;配置格式可能有所不同。本地 /ai 辅助函数在 Node.js 或 Bun 中读取已安装的软件包版本,绝不会自动连接此服务器。

MCP / Streamable HTTP
{
    "mcpServers": {
        "rentnerPackages": {
            "url": "https://packages.rentner.dev/mcp"
        }
    }
}

工具:list_packages、read_package_docs、read_package_api、read_package_examples 和 search_package_docs。

API 与类型

此版本已发布的函数签名、属性和类型。展开条目即可查看定义及可用的导入路径。

CustomInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/input
CustomInput.d.ts
export const CustomInput: import("react").ForwardRefExoticComponent<CustomInputComponentProps & import("react").RefAttributes<CustomInputElement>>
InputProviderfunction
  • @rentnerkev/inputs
InputProvider.d.ts
export function InputProvider(props: InputProviderProps): import("react").JSX.Element
CheckboxInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
CheckboxInput.d.ts
export const CheckboxInput: import("react").ForwardRefExoticComponent<CheckboxInputProps & import("react").RefAttributes<HTMLInputElement>>
FileInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
FileInput.d.ts
export const FileInput: import("react").ForwardRefExoticComponent<FileInputProps & import("react").RefAttributes<HTMLInputElement>>
RadioInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
RadioInput.d.ts
export const RadioInput: import("react").ForwardRefExoticComponent<RadioInputProps & import("react").RefAttributes<HTMLInputElement>>
RangeInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
RangeInput.d.ts
export const RangeInput: import("react").ForwardRefExoticComponent<RangeInputProps & import("react").RefAttributes<HTMLInputElement>>
EmailInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/email-input
EmailInput.d.ts
export const EmailInput: import("react").ForwardRefExoticComponent<EmailInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
MoneyInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/money-input
MoneyInput.d.ts
export const MoneyInput: import("react").ForwardRefExoticComponent<MoneyInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
NumberInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/number-input
NumberInput.d.ts
export const NumberInput: import("react").ForwardRefExoticComponent<NumberInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
OtpInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/otp-input
OtpInput.d.ts
export const OtpInput: import("react").ForwardRefExoticComponent<OtpInputProps & import("react").RefAttributes<HTMLInputElement>>
PasswordInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/password-input
PasswordInput.d.ts
export const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
PhoneInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/phone-input
PhoneInput.d.ts
export const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
QuantityInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/quantity-input
QuantityInput.d.ts
export const QuantityInput: import("react").ForwardRefExoticComponent<QuantityInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
Textareaconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/textarea
Textarea.d.ts
export const Textarea: import("react").ForwardRefExoticComponent<TextareaComponentProps & import("react").RefAttributes<HTMLTextAreaElement>>
TextInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/text-input
TextInput.d.ts
export const TextInput: import("react").ForwardRefExoticComponent<TextInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
SearchInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/search-input
SearchInput.d.ts
export const SearchInput: import("react").ForwardRefExoticComponent<SearchInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
NativeTimeInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/native-time-input
NativeTimeInput.d.ts
export const NativeTimeInput: import("react").ForwardRefExoticComponent<NativeTimeInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
TimeInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/time-input
TimeInput.d.ts
export const TimeInput: import("react").ForwardRefExoticComponent<TimeInputComponentProps & import("react").RefAttributes<HTMLInputElement>>
inputMessageCatalogconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/messages
inputMessageCatalog.d.ts
export const inputMessageCatalog: Record<'de' | 'en' | 'es' | 'fr', Required<InputMessages>>
resolveInputIntlLocalefunction
  • @rentnerkev/inputs
  • @rentnerkev/inputs/messages
resolveInputIntlLocale.d.ts
export function resolveInputIntlLocale(locale?: InputLocale): string
resolveInputMessagesfunction
  • @rentnerkev/inputs
  • @rentnerkev/inputs/messages
resolveInputMessages.d.ts
export function resolveInputMessages(locale?: InputLocale, messages?: Partial<InputMessages>): Required<InputMessages>
CustomDesigninterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomDesign.d.ts
export interface CustomDesign {
    bg?: string
    border?: string
    text?: string
    labelText?: string
    placeholder?: string
    focusRing?: string
    focusBorder?: string
    errorBorder?: string
    errorRing?: string
    errorRingBase?: string
    errorText?: string
    iconColor?: string
    iconFocus?: string
    counterBg?: string
    counterText?: string
    counterBorderFocus?: string
    passwordStrengthTrack?: string
    passwordStrengthText?: string
    passwordStrengthWeak?: string
    passwordStrengthFair?: string
    passwordStrengthGood?: string
    passwordStrengthStrong?: string
}
CustomInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomInputComponentProps.d.ts
export type CustomInputComponentProps = CustomInputProps | CustomInputTextProps | CustomInputValueProps
CustomInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomInputProps.d.ts
export interface CustomInputProps extends Omit<InputHTMLAttributes<CustomInputElement>, ReplacedCustomAttributes>, Omit<InputVisualProps, 'triggerRef'>, NumericValueProps {
    value: string
    onChange: ChangeEventHandler<CustomInputElement>
    onValueChange?: (value: string) => void
    type?: CustomInputType
    triggerRef?: InputVisualProps['triggerRef'] | Ref<HTMLButtonElement>
    rows?: number
    wrap?: 'hard' | 'soft' | 'off'
    currency?: string
    suffix?: string
    showPasswordStrength?: boolean
    minuteStep?: number
}

type ReplacedCustomAttributes = 'value' | 'defaultValue' | 'onChange' | 'type'
CustomInputTextPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomInputTextProps.d.ts
export interface CustomInputTextProps extends Omit<CustomInputProps, 'type'> {
    type?: 'text' | 'textarea'
    onValueChange?: (value: string) => void
}
CustomInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomInputValueProps.d.ts
export type CustomInputValueProps = Omit<CustomInputProps, 'onChange'> & {
    type?: CustomInputType
    onChange?: never
    onValueChange: (value: string) => void
}
CustomInputTypetype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
CustomInputType.d.ts
export type CustomInputType = 'text' | 'search' | 'number' | 'phone' | 'email' | 'money' | 'password' | 'quantity' | 'time' | 'native-time' | 'textarea'
EmailInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
EmailInputComponentProps.d.ts
export type EmailInputComponentProps = EmailInputProps | EmailInputValueProps
EmailInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
EmailInputProps.d.ts
export interface EmailInputProps extends BaseInputProps {
    type?: 'email'
    onValueChange?: (value: string) => void
}
EmailInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
EmailInputValueProps.d.ts
export type EmailInputValueProps = Omit<EmailInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
MoneyInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
MoneyInputComponentProps.d.ts
export type MoneyInputComponentProps = MoneyInputProps | MoneyInputValueProps
MoneyInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
MoneyInputProps.d.ts
export interface MoneyInputProps extends BaseInputProps {
    type?: 'money'
    currency?: string
    onValueChange?: (value: string) => void
}
MoneyInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
MoneyInputValueProps.d.ts
export type MoneyInputValueProps = Omit<MoneyInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
NumberInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
NumberInputComponentProps.d.ts
export type NumberInputComponentProps = NumberInputProps | NumberInputValueProps
NumberInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
NumberInputProps.d.ts
export interface NumberInputProps extends BaseInputProps, NumericValueProps {
    type?: 'number'
    onValueChange?: (value: string) => void
}
NumberInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
NumberInputValueProps.d.ts
export type NumberInputValueProps = Omit<NumberInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
NativeTimeInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/native-time-input
  • @rentnerkev/inputs/types
NativeTimeInputComponentProps.d.ts
export type NativeTimeInputComponentProps = NativeTimeInputProps | NativeTimeInputValueProps
NativeTimeInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/native-time-input
  • @rentnerkev/inputs/types
NativeTimeInputProps.d.ts
export interface NativeTimeInputProps extends BaseInputProps {
    type?: 'time'
    onValueChange?: (value: string) => void
}
NativeTimeInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/native-time-input
  • @rentnerkev/inputs/types
NativeTimeInputValueProps.d.ts
export type NativeTimeInputValueProps = Omit<NativeTimeInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
OtpFeedbackClassNamesinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
OtpFeedbackClassNames.d.ts
export interface OtpFeedbackClassNames {
    focus?: string
    filled?: string
    error?: string
    success?: string
    progressTrack?: string
    progressFilled?: string
    progressError?: string
    progressSuccess?: string
    errorAnimation?: string
    successAnimation?: string
    errorMessage?: string
    successMessage?: string
}
OtpInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
OtpInputProps.d.ts
export interface OtpInputProps {
    controlSize?: 'sm' | 'md' | 'lg'
    classNames?: import('./InputProvider.types.ts').InputClassNames
    id?: string
    name?: string
    value: ReadonlyArray<string>
    onValueChange: (value: Array<string>) => void
    onComplete?: (value: string) => void
    length?: number
    label?: ReactNode
    description?: ReactNode
    error?: string | null
    status?: OtpInputStatus
    animated?: boolean
    showProgress?: boolean
    feedbackClassNames?: OtpFeedbackClassNames
    required?: boolean
    disabled?: boolean
    readOnly?: boolean
    autoFocus?: boolean
    className?: string
    inputClassName?: string
    customDesign?: CustomDesign
    locale?: InputLocale
    messages?: Partial<InputMessages>
    validationMode?: InputValidationMode
    triggerRef?: Ref<HTMLInputElement>
    'aria-label'?: string
    'aria-labelledby'?: string
    'aria-describedby'?: string
}
OtpInputStatustype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
OtpInputStatus.d.ts
export type OtpInputStatus = 'idle' | 'error' | 'success'
PasswordInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PasswordInputComponentProps.d.ts
export type PasswordInputComponentProps = PasswordInputProps | PasswordInputValueProps
PasswordInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PasswordInputProps.d.ts
export interface PasswordInputProps extends BaseInputProps {
    type?: 'password'
    showPasswordStrength?: boolean
    onValueChange?: (value: string) => void
}
PasswordInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PasswordInputValueProps.d.ts
export type PasswordInputValueProps = Omit<PasswordInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
PhoneInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PhoneInputComponentProps.d.ts
export type PhoneInputComponentProps = PhoneInputProps | PhoneInputValueProps
PhoneInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PhoneInputProps.d.ts
export interface PhoneInputProps extends BaseInputProps {
    type?: 'phone'
    onValueChange?: (value: string) => void
}
PhoneInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PhoneInputValueProps.d.ts
export type PhoneInputValueProps = Omit<PhoneInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
QuantityInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
QuantityInputComponentProps.d.ts
export type QuantityInputComponentProps = QuantityInputProps | QuantityInputValueProps
QuantityInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
QuantityInputProps.d.ts
export interface QuantityInputProps extends BaseInputProps, NumericValueProps {
    type?: 'quantity'
    suffix?: string
    onValueChange?: (value: string) => void
}
QuantityInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
QuantityInputValueProps.d.ts
export type QuantityInputValueProps = Omit<QuantityInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
SearchInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/search-input
  • @rentnerkev/inputs/types
SearchInputComponentProps.d.ts
export type SearchInputComponentProps = SearchInputProps | SearchInputValueProps
SearchInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/search-input
  • @rentnerkev/inputs/types
SearchInputProps.d.ts
export interface SearchInputProps extends BaseInputProps {
    type?: 'search'
    onValueChange?: (value: string) => void
}
SearchInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/search-input
  • @rentnerkev/inputs/types
SearchInputValueProps.d.ts
export type SearchInputValueProps = Omit<SearchInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
TextareaComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextareaComponentProps.d.ts
export type TextareaComponentProps = TextareaProps | TextareaValueProps
TextareaPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextareaProps.d.ts
export interface TextareaProps extends BaseTextareaProps {
    type?: 'textarea'
    onValueChange?: (value: string) => void
}
TextareaValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextareaValueProps.d.ts
export type TextareaValueProps = Omit<TextareaProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
TextInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextInputComponentProps.d.ts
export type TextInputComponentProps = TextInputProps | TextInputValueProps
TextInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextInputProps.d.ts
export interface TextInputProps extends BaseInputProps {
    type?: 'text'
    onValueChange?: (value: string) => void
}
TextInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TextInputValueProps.d.ts
export type TextInputValueProps = Omit<TextInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
TimeInputComponentPropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TimeInputComponentProps.d.ts
export type TimeInputComponentProps = TimeInputProps | TimeInputValueProps
TimeInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TimeInputProps.d.ts
export interface TimeInputProps extends Omit<BaseInputProps, 'triggerRef'> {
    type?: 'time'
    minuteStep?: number
    triggerRef?: Ref<HTMLButtonElement>
    onValueChange?: (value: string) => void
}
TimeInputValuePropstype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
TimeInputValueProps.d.ts
export type TimeInputValueProps = Omit<TimeInputProps, 'onChange'> & {
    onChange?: never
    onValueChange: (value: string) => void
}
InputLocaletype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
  • @rentnerkev/inputs/messages
InputLocale.d.ts
export type InputLocale = 'de' | 'en' | 'es' | 'fr' | (string & {})
InputMessagesinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
  • @rentnerkev/inputs/messages
InputMessages.d.ts
export interface InputMessages {
    required: string
    minLength: (minLength: number) => string
    invalidInput: string
    invalidEmail: string
    invalidPhone: string
    onlyNumbers: string
    minValue: (minValue: number) => string
    maxValue: (maxValue: number) => string
    onlyMoneyCharacters: string
    passwordStrength: string
    passwordStrengthEmpty: string
    passwordStrengthVeryWeak: string
    passwordStrengthWeak: string
    passwordStrengthOkay: string
    passwordStrengthStrong: string
    passwordStrengthVeryStrong: string
    showPassword: string
    hidePassword: string
    hourSelect: string
    hourPlaceholder: string
    minuteSelect: string
    minutePlaceholder: string
    otpCode: string
    otpDigit: (position: number, count: number) => string
    otpIncomplete: (count: number) => string
    otpInvalid?: string
    otpVerified?: string
}
InputClassNamesinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
InputClassNames.d.ts
export interface InputClassNames {
    root?: string
    label?: string
    description?: string
    error?: string
    control?: string
    leading?: string
    trailing?: string
    counter?: string
    wrapper?: string
    input?: string
    textarea?: string
    checkbox?: string
    radio?: string
    range?: string
    file?: string
    otp?: string
}
InputProviderPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
InputProviderProps.d.ts
export interface InputProviderProps {
    controlSize?: 'sm' | 'md' | 'lg'
    portalContainer?: Element | DocumentFragment | null
    portalClassName?: string
    portalZIndex?: number
    children: ReactNode
    locale?: InputLocale
    messages?: Partial<InputMessages>
    customDesign?: CustomDesign
    classNames?: InputClassNames
    validationMode?: InputValidationMode
}
InputValidationModetype
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
InputValidationMode.d.ts
export type InputValidationMode = 'built-in' | 'external'
CheckboxInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
  • @rentnerkev/inputs/types
CheckboxInputProps.d.ts
export interface CheckboxInputProps extends NativeInputProps {
    type?: 'checkbox'
}

type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & Pick<import('./InputShared.types.ts').InputVisualProps, 'controlSize' | 'classNames'>
RadioInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
  • @rentnerkev/inputs/types
RadioInputProps.d.ts
export interface RadioInputProps extends NativeInputProps {
    type?: 'radio'
}

type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & Pick<import('./InputShared.types.ts').InputVisualProps, 'controlSize' | 'classNames'>
RangeInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
  • @rentnerkev/inputs/types
RangeInputProps.d.ts
export interface RangeInputProps extends NativeInputProps {
    type?: 'range'
}

type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & Pick<import('./InputShared.types.ts').InputVisualProps, 'controlSize' | 'classNames'>
FileInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/checkbox-input
  • @rentnerkev/inputs/radio-input
  • @rentnerkev/inputs/range-input
  • @rentnerkev/inputs/file-input
  • @rentnerkev/inputs/types
FileInputProps.d.ts
export interface FileInputProps extends NativeInputProps {
    type?: 'file'
}

type NativeInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'type'> & Pick<import('./InputShared.types.ts').InputVisualProps, 'controlSize' | 'classNames'>
BaseInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
BaseInputProps.d.ts
export interface BaseInputProps extends Omit<InputHTMLAttributes<HTMLInputElement>, ReplacedInputAttributes>, InputVisualProps {
    value: string
    onChange: ChangeEventHandler<HTMLInputElement>
}

type ReplacedInputAttributes = 'value' | 'defaultValue' | 'onChange' | 'type'
BaseTextareaPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
BaseTextareaProps.d.ts
export interface BaseTextareaProps extends Omit<TextareaHTMLAttributes<HTMLTextAreaElement>, ReplacedTextareaAttributes>, InputVisualProps {
    value: string
    onChange: ChangeEventHandler<HTMLTextAreaElement>
}

type ReplacedTextareaAttributes = 'value' | 'defaultValue' | 'onChange'
InputVisualPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
InputVisualProps.d.ts
export interface InputVisualProps {
    controlSize?: 'sm' | 'md' | 'lg'
    classNames?: InputClassNames
    portalContainer?: Element | DocumentFragment | null
    portalClassName?: string
    portalZIndex?: number
    label?: ReactNode
    description?: ReactNode
    error?: string | null
    icon?: ReactNode
    customDesign?: CustomDesign
    showLength?: boolean
    locale?: InputLocale
    messages?: Partial<InputMessages>
    triggerRef?: Ref<HTMLInputElement | HTMLTextAreaElement>
    validationMode?: InputValidationMode
}
NumericValuePropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
NumericValueProps.d.ts
export interface NumericValueProps {
    minValue?: number
    maxValue?: number
}
PasswordStrengthinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
PasswordStrength.d.ts
export interface PasswordStrength {
    score: number
    percentage: number
    label: string
}
getInputFieldPropsfunction
  • @rentnerkev/inputs
  • @rentnerkev/inputs/form
getInputFieldProps.d.ts
export function getInputFieldProps<T>(field: FieldAdapter<T>, options?: FieldAdapterOptions): {
    name: string
    value: T
    onValueChange: (value: T) => void
    onBlur: () => void
    error: string | null
    validationMode: 'external'
}
getFieldErrorfunction
  • @rentnerkev/inputs
  • @rentnerkev/inputs/form
getFieldError.d.ts
export function getFieldError<T>(field: FieldAdapter<T>, options?: FieldAdapterOptions): string | null
mapFieldErrorfunction
  • @rentnerkev/inputs
  • @rentnerkev/inputs/form
mapFieldError.d.ts
export function mapFieldError(error: unknown): string | null
FieldAdapterinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/form
FieldAdapter.d.ts
export interface FieldAdapter<T> {
    name: string
    state: {
        value: T
        meta?: {
            errors?: readonly unknown[]
            isTouched?: boolean
        }
    }
    handleChange: (value: T) => void
    handleBlur: () => void
}
FieldAdapterOptionsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/form
FieldAdapterOptions.d.ts
export interface FieldAdapterOptions {
    showErrors?: 'touched' | 'always' | 'never'
    mapError?: (error: unknown) => string | null | undefined
}
NumericInputconst
  • @rentnerkev/inputs
  • @rentnerkev/inputs/numeric-input
NumericInput.d.ts
export const NumericInput: import("react").ForwardRefExoticComponent<NumericInputProps & import("react").RefAttributes<HTMLInputElement>>
NumericInputPropsinterface
  • @rentnerkev/inputs
  • @rentnerkev/inputs/types
  • @rentnerkev/inputs/numeric-input
NumericInputProps.d.ts
export interface NumericInputProps extends Omit<BaseInputProps, 'value' | 'onChange'> {
    value: number | null
    onValueChange: (value: number | null) => void
}
PackageInfointerface
  • @rentnerkev/inputs/ai
PackageInfo.d.ts
export interface PackageInfo {
    name: string
    version: string
    description: string
    license: string
    homepage: string
    repository: {
        type: string
        url: string
    }
    exports: Record<string, string | {
        types?: string
        import?: string
        default?: string
    }>
    peerDependencies: Record<string, string>
}
PackageDocumentinterface
  • @rentnerkev/inputs/ai
PackageDocument.d.ts
export interface PackageDocument {
    path: string
    content: string
}
PackageApiinterface
  • @rentnerkev/inputs/ai
PackageApi.d.ts
export interface PackageApi {
    package: string
    version: string
    subpaths: Record<string, string>
    declarations: PackageDocument[]
}
PackageSearchMatchinterface
  • @rentnerkev/inputs/ai
PackageSearchMatch.d.ts
export interface PackageSearchMatch {
    path: string
    line: number
    text: string
}
PackageExampleinterface
  • @rentnerkev/inputs/ai
PackageExample.d.ts
export interface PackageExample {
    language: string
    code: string
}
getPackageInfofunction
  • @rentnerkev/inputs/ai
getPackageInfo.d.ts
export function getPackageInfo(): PackageInfo
getPackageDocumentationfunction
  • @rentnerkev/inputs/ai
getPackageDocumentation.d.ts
export function getPackageDocumentation(document?: 'readme' | 'usage'): PackageDocument
getPackageApifunction
  • @rentnerkev/inputs/ai
getPackageApi.d.ts
export function getPackageApi(options?: {
    subpath?: string
    symbol?: string
}): PackageApi
searchPackageDocumentationfunction
  • @rentnerkev/inputs/ai
searchPackageDocumentation.d.ts
export function searchPackageDocumentation(query: string): PackageSearchMatch[]
getPackageExamplesfunction
  • @rentnerkev/inputs/ai
getPackageExamples.d.ts
export function getPackageExamples(): PackageExample[]