DocumentationInputs
Inputs
Every field has a purpose. Give it the right input.
Getting started
Install the package
Use React 19 and import the package stylesheet once in your app’s global CSS. The bundled styles are built for Tailwind CSS 4.
bun add @rentnerkev/inputs@import '@rentnerkev/inputs/tailwind.css';Inputs 2.8.2: native numeric bounds#
NumberInput and QuantityInput resolve each native min/max before the corresponding minValue/maxValue alias. Numeric strings are accepted. An omitted native bound uses its alias; an explicit empty or nonfinite native bound clears that bound instead of falling back to the alias. Use finite numeric bounds in normal forms. Built-in validation and the maximum edit guard use the resolved bounds. QuantityInput keeps an integer-string value; its suffix is presentation only.
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#
New in 2.8.0: NumericInput controls number | null instead of a string. Empty, sign and decimal drafts stay editable until blur or Enter commits a finite decimal; a comma is accepted and empty input commits null. Incomplete drafts, exponents, hex and infinity revert to the controlled value. Native min/max report errors without clamping. NumberInput, MoneyInput and QuantityInput keep their existing string APIs.
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}
/>
)
}Field sizes, slots & time portals#
New in 2.8.0: controlSize on InputProvider or a field selects sm/md/lg (36/44/48 px); omission preserves previous geometry, and explicit sizes also affect textareas. classNames merges provider and local root, label, description, error, wrapper, control, leading, trailing and counter slots with the existing control-specific slots. The new control slot replaces visual defaults; legacy className/input/textarea retain customDesign. Native checkbox, radio, range and file controls have no field shell. TimeInput inherits portalContainer, portalClassName and portalZIndex; null selects document.body.
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-free form adapter#
getInputFieldProps from /form connects name, direct value changes, blur and external errors without a form-library runtime dependency. Supply a structural field with state.value, optional meta.errors/isTouched, handleChange and handleBlur inside a subscribed field render. Errors appear after touch by default; showErrors and mapError customize this. validationMode is external, while required still exposes required semantics. The adapter also preserves number | null for NumericInput.
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
/>
)
}Form error helpers#
The UI-free /form entry exports getFieldError and mapFieldError. getFieldError returns the first readable error after touch by default; showErrors accepts touched, always or never, and mapError handles application-specific errors. mapFieldError accepts strings or objects with a string message and otherwise returns null. The helper reads the supplied field snapshot; call it again inside your subscribed field render when state changes.
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' })Local AI helpers: metadata & guides#
Import the /ai entry in a local Node.js or Bun script. These synchronous, read-only helpers use node:fs to read the installed package without importing its UI. getPackageInfo() returns PackageInfo, including the installed version, public exports and peer dependencies. getPackageDocumentation() returns a PackageDocument with path and content; its default is usage, and readme selects README.md. Only these two packaged documents are accepted. Results describe your installed version, which can differ from this website.
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)Local AI helpers: public declarations#
getPackageApi() returns PackageApi with package, installed version, selected subpaths and declarations as PackageDocument objects. It reads public typed entries and their local declaration dependencies; /ai itself is excluded. Use subpath such as . or ./types to select a public entry. symbol validates that a name is exported by the selected entry; it does not trim declaration files to that symbol. Unknown subpaths, invalid names and names not exported by the selected entry throw errors. Callers cannot provide arbitrary file paths.
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)
}Local AI helpers: search & examples#
searchPackageDocumentation(query) searches README.md and docs/usage.md using a trimmed, case-insensitive literal query. It returns PackageSearchMatch objects with path, a one-based line number and matching text; an empty query returns an empty array. getPackageExamples() returns every fenced code block from the installed usage guide as a PackageExample with language and code. These helpers return text for your own tools; they do not execute examples or contact an AI service.
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#
Choose an input dynamically with type: text, search, number, phone, email, money, password, quantity, time, native-time or textarea. This dispatcher shares the controlled value, validation and design props with the specialized components. Numeric values are strings, and you can use either onValueChange or the event-based onChange interface.
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#
A single-line text field with optional length feedback. Use minLength and maxLength for length limits, and showLength for the counter. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A native search field for filters or search terms. It manages the input, while your application decides what to search and when. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
An email field with built-in format validation. Combine required with error when displaying a server-side validation result. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A numeric field with native min/max constraints and legacy minValue/maxValue aliases. Native bounds take precedence. Values above the effective maximum are rejected during editing; the minimum participates in validation. The callback returns a string, preserving empty input; convert when committing the form. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
Accepts a monetary value as text and formats it with Intl.NumberFormat when unfocused. currency is an ISO currency code, defaulting to EUR. locale controls decimal and grouping conventions. Keep the editable value as text. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A password field with visibility controls and optional strength feedback through showPasswordStrength. Strength feedback helps users choose a password; your server still decides the password policy. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A phone-number field with conservative format validation. Nonempty values start with a digit or opening parenthesis after an optional + and may contain digits, balanced parentheses, whitespace, dots, slashes and hyphens; at least one digit is needed. Optional empty values remain valid. It preserves the entered string and does not format, infer a country or verify that a number exists. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A quantity field with minValue, maxValue and an optional suffix such as kg or pieces. The suffix is presentation; the controlled value remains the entered string. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A custom hour/minute selector using a time string. minuteStep sets the minute interval. triggerRef points to its button rather than a text input; use NativeTimeInput when you want the browser’s own time editor. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
Uses the browser’s native time input. Standard min, max and step attributes restrict times, with step expressed in seconds. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
A multi-line text area. rows controls the initial height and wrap controls line wrapping; maxLength and showLength can expose a character limit. This is a controlled field: value is a string and onValueChange receives the next string. Common field props include label, description, required, disabled, readOnly, error and normal HTML input attributes.
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#
Use one string per digit in a controlled array. length sets the number of cells; onValueChange updates the array and onComplete receives the completed code as a string. Keyboard movement and pasted codes are handled by the component. status accepts idle, error or success; animated, showProgress and feedbackClassNames customize verification feedback. Send the code to your own verification endpoint.
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#
A styled native checkbox with normal checked, onChange, name, value, required and ref props. Read event.target.checked for its boolean state. Associate a visible HTML label with its id; the primitive does not use the text-field label prop.
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#
A native radio control. Give related radios the same name, distinct values and associated labels; manage checked for each option. Use a fieldset and legend to name the whole group.
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#
A native slider with min, max and step. Its change event exposes valueAsNumber when your state is numeric. Provide a label and display the current value next to it.
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#
A native file picker. Use accept and multiple to guide selection, then read event.target.files. Keep the file input uncontrolled; browsers do not let you assign a filename as its value. The component selects files; uploading and checking their contents belong to your application.
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#
Set shared locale, messages, customDesign, validationMode and classNames once. classNames has separate slots for input, textarea, checkbox, radio, range, file and otp. A component’s own props override provider defaults. Primitive controls accept normal native attributes and inherit their provider class slot.
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>
)
}Validation, errors & form integration#
built-in is the validation mode for the package’s own checks. external lets a form library or your application provide the error message. Use name for native FormData, id/label for the accessible field name and description for supporting instructions. required, minLength and numeric minValue/maxValue express constraints. triggerRef focuses a field programmatically; specialized text fields also forward their native ref.
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}
/>
)
}Event-based onChange#
Text fields also accept the classic React change-event interface. Use onChange to read event.target.value or onValueChange to receive the string directly. Primitive checkbox, radio, range and file controls use native onChange instead of onValueChange.
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}
/>
)
}Messages & international locales#
inputMessageCatalog includes de, en, es and fr. resolveInputMessages merges a partial message object with the catalog; function-valued messages receive limits or OTP positions. resolveInputIntlLocale maps short locale codes to Intl locales and preserves custom locale strings. Pass locale and messages to a field or InputProvider. Translate your own labels and placeholders yourself.
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')Custom design & OTP feedback#
CustomDesign covers field background, border, text, label, placeholder, focus and error states, icons and counters. Password strength has separate track, text and weak/fair/good/strong slots. OTP also accepts inputClassName and feedbackClassNames for filled, focus, error, success, progress and animation states. Unspecified slots keep the package defaults.
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}
/>
)
}Docs for your AI tools
Connect a compatible MCP client to read package APIs, guides and examples. Public access, no account or API key required.
Remote access is optional: add this public URL yourself to your MCP client. Clients use Streamable HTTP; the configuration format may vary. The local package /ai helpers read the installed version in Node.js or Bun and never connect to this server automatically.
{
"mcpServers": {
"rentnerPackages": {
"url": "https://packages.rentner.dev/mcp"
}
}
}Tools: list_packages, read_package_docs, read_package_api, read_package_examples and search_package_docs.
TypeScript / v2.8.2
API & types
Published signatures, props and types for this version. Expand an entry to inspect its definition and available import paths.
CustomInputconst
@rentnerkev/inputs@rentnerkev/inputs/input
export const CustomInput: import("react").ForwardRefExoticComponent<CustomInputComponentProps & import("react").RefAttributes<CustomInputElement>>InputProviderfunction
@rentnerkev/inputs
export function InputProvider(props: InputProviderProps): import("react").JSX.ElementCheckboxInputconst
@rentnerkev/inputs@rentnerkev/inputs/checkbox-input@rentnerkev/inputs/radio-input@rentnerkev/inputs/range-input@rentnerkev/inputs/file-input
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
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
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
export const RangeInput: import("react").ForwardRefExoticComponent<RangeInputProps & import("react").RefAttributes<HTMLInputElement>>EmailInputconst
@rentnerkev/inputs@rentnerkev/inputs/email-input
export const EmailInput: import("react").ForwardRefExoticComponent<EmailInputComponentProps & import("react").RefAttributes<HTMLInputElement>>MoneyInputconst
@rentnerkev/inputs@rentnerkev/inputs/money-input
export const MoneyInput: import("react").ForwardRefExoticComponent<MoneyInputComponentProps & import("react").RefAttributes<HTMLInputElement>>NumberInputconst
@rentnerkev/inputs@rentnerkev/inputs/number-input
export const NumberInput: import("react").ForwardRefExoticComponent<NumberInputComponentProps & import("react").RefAttributes<HTMLInputElement>>OtpInputconst
@rentnerkev/inputs@rentnerkev/inputs/otp-input
export const OtpInput: import("react").ForwardRefExoticComponent<OtpInputProps & import("react").RefAttributes<HTMLInputElement>>PasswordInputconst
@rentnerkev/inputs@rentnerkev/inputs/password-input
export const PasswordInput: import("react").ForwardRefExoticComponent<PasswordInputComponentProps & import("react").RefAttributes<HTMLInputElement>>PhoneInputconst
@rentnerkev/inputs@rentnerkev/inputs/phone-input
export const PhoneInput: import("react").ForwardRefExoticComponent<PhoneInputComponentProps & import("react").RefAttributes<HTMLInputElement>>QuantityInputconst
@rentnerkev/inputs@rentnerkev/inputs/quantity-input
export const QuantityInput: import("react").ForwardRefExoticComponent<QuantityInputComponentProps & import("react").RefAttributes<HTMLInputElement>>Textareaconst
@rentnerkev/inputs@rentnerkev/inputs/textarea
export const Textarea: import("react").ForwardRefExoticComponent<TextareaComponentProps & import("react").RefAttributes<HTMLTextAreaElement>>TextInputconst
@rentnerkev/inputs@rentnerkev/inputs/text-input
export const TextInput: import("react").ForwardRefExoticComponent<TextInputComponentProps & import("react").RefAttributes<HTMLInputElement>>SearchInputconst
@rentnerkev/inputs@rentnerkev/inputs/search-input
export const SearchInput: import("react").ForwardRefExoticComponent<SearchInputComponentProps & import("react").RefAttributes<HTMLInputElement>>NativeTimeInputconst
@rentnerkev/inputs@rentnerkev/inputs/native-time-input
export const NativeTimeInput: import("react").ForwardRefExoticComponent<NativeTimeInputComponentProps & import("react").RefAttributes<HTMLInputElement>>TimeInputconst
@rentnerkev/inputs@rentnerkev/inputs/time-input
export const TimeInput: import("react").ForwardRefExoticComponent<TimeInputComponentProps & import("react").RefAttributes<HTMLInputElement>>inputMessageCatalogconst
@rentnerkev/inputs@rentnerkev/inputs/messages
export const inputMessageCatalog: Record<'de' | 'en' | 'es' | 'fr', Required<InputMessages>>resolveInputIntlLocalefunction
@rentnerkev/inputs@rentnerkev/inputs/messages
export function resolveInputIntlLocale(locale?: InputLocale): stringresolveInputMessagesfunction
@rentnerkev/inputs@rentnerkev/inputs/messages
export function resolveInputMessages(locale?: InputLocale, messages?: Partial<InputMessages>): Required<InputMessages>CustomDesigninterface
@rentnerkev/inputs@rentnerkev/inputs/types
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
export type CustomInputComponentProps = CustomInputProps | CustomInputTextProps | CustomInputValuePropsCustomInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
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
export interface CustomInputTextProps extends Omit<CustomInputProps, 'type'> {
type?: 'text' | 'textarea'
onValueChange?: (value: string) => void
}CustomInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type CustomInputValueProps = Omit<CustomInputProps, 'onChange'> & {
type?: CustomInputType
onChange?: never
onValueChange: (value: string) => void
}CustomInputTypetype
@rentnerkev/inputs@rentnerkev/inputs/types
export type CustomInputType = 'text' | 'search' | 'number' | 'phone' | 'email' | 'money' | 'password' | 'quantity' | 'time' | 'native-time' | 'textarea'EmailInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type EmailInputComponentProps = EmailInputProps | EmailInputValuePropsEmailInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface EmailInputProps extends BaseInputProps {
type?: 'email'
onValueChange?: (value: string) => void
}EmailInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type EmailInputValueProps = Omit<EmailInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}MoneyInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type MoneyInputComponentProps = MoneyInputProps | MoneyInputValuePropsMoneyInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface MoneyInputProps extends BaseInputProps {
type?: 'money'
currency?: string
onValueChange?: (value: string) => void
}MoneyInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type MoneyInputValueProps = Omit<MoneyInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}NumberInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type NumberInputComponentProps = NumberInputProps | NumberInputValuePropsNumberInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface NumberInputProps extends BaseInputProps, NumericValueProps {
type?: 'number'
onValueChange?: (value: string) => void
}NumberInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type NumberInputValueProps = Omit<NumberInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}NativeTimeInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/native-time-input@rentnerkev/inputs/types
export type NativeTimeInputComponentProps = NativeTimeInputProps | NativeTimeInputValuePropsNativeTimeInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/native-time-input@rentnerkev/inputs/types
export interface NativeTimeInputProps extends BaseInputProps {
type?: 'time'
onValueChange?: (value: string) => void
}NativeTimeInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/native-time-input@rentnerkev/inputs/types
export type NativeTimeInputValueProps = Omit<NativeTimeInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}OtpFeedbackClassNamesinterface
@rentnerkev/inputs@rentnerkev/inputs/types
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
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
export type OtpInputStatus = 'idle' | 'error' | 'success'PasswordInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type PasswordInputComponentProps = PasswordInputProps | PasswordInputValuePropsPasswordInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface PasswordInputProps extends BaseInputProps {
type?: 'password'
showPasswordStrength?: boolean
onValueChange?: (value: string) => void
}PasswordInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type PasswordInputValueProps = Omit<PasswordInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}PhoneInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type PhoneInputComponentProps = PhoneInputProps | PhoneInputValuePropsPhoneInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface PhoneInputProps extends BaseInputProps {
type?: 'phone'
onValueChange?: (value: string) => void
}PhoneInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type PhoneInputValueProps = Omit<PhoneInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}QuantityInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type QuantityInputComponentProps = QuantityInputProps | QuantityInputValuePropsQuantityInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface QuantityInputProps extends BaseInputProps, NumericValueProps {
type?: 'quantity'
suffix?: string
onValueChange?: (value: string) => void
}QuantityInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type QuantityInputValueProps = Omit<QuantityInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}SearchInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/search-input@rentnerkev/inputs/types
export type SearchInputComponentProps = SearchInputProps | SearchInputValuePropsSearchInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/search-input@rentnerkev/inputs/types
export interface SearchInputProps extends BaseInputProps {
type?: 'search'
onValueChange?: (value: string) => void
}SearchInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/search-input@rentnerkev/inputs/types
export type SearchInputValueProps = Omit<SearchInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}TextareaComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TextareaComponentProps = TextareaProps | TextareaValuePropsTextareaPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface TextareaProps extends BaseTextareaProps {
type?: 'textarea'
onValueChange?: (value: string) => void
}TextareaValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TextareaValueProps = Omit<TextareaProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}TextInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TextInputComponentProps = TextInputProps | TextInputValuePropsTextInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface TextInputProps extends BaseInputProps {
type?: 'text'
onValueChange?: (value: string) => void
}TextInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TextInputValueProps = Omit<TextInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}TimeInputComponentPropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TimeInputComponentProps = TimeInputProps | TimeInputValuePropsTimeInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface TimeInputProps extends Omit<BaseInputProps, 'triggerRef'> {
type?: 'time'
minuteStep?: number
triggerRef?: Ref<HTMLButtonElement>
onValueChange?: (value: string) => void
}TimeInputValuePropstype
@rentnerkev/inputs@rentnerkev/inputs/types
export type TimeInputValueProps = Omit<TimeInputProps, 'onChange'> & {
onChange?: never
onValueChange: (value: string) => void
}InputLocaletype
@rentnerkev/inputs@rentnerkev/inputs/types@rentnerkev/inputs/messages
export type InputLocale = 'de' | 'en' | 'es' | 'fr' | (string & {})InputMessagesinterface
@rentnerkev/inputs@rentnerkev/inputs/types@rentnerkev/inputs/messages
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
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
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
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
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
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
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
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
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
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
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
export interface NumericValueProps {
minValue?: number
maxValue?: number
}PasswordStrengthinterface
@rentnerkev/inputs@rentnerkev/inputs/types
export interface PasswordStrength {
score: number
percentage: number
label: string
}getInputFieldPropsfunction
@rentnerkev/inputs@rentnerkev/inputs/form
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
export function getFieldError<T>(field: FieldAdapter<T>, options?: FieldAdapterOptions): string | nullmapFieldErrorfunction
@rentnerkev/inputs@rentnerkev/inputs/form
export function mapFieldError(error: unknown): string | nullFieldAdapterinterface
@rentnerkev/inputs@rentnerkev/inputs/form
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
export interface FieldAdapterOptions {
showErrors?: 'touched' | 'always' | 'never'
mapError?: (error: unknown) => string | null | undefined
}NumericInputconst
@rentnerkev/inputs@rentnerkev/inputs/numeric-input
export const NumericInput: import("react").ForwardRefExoticComponent<NumericInputProps & import("react").RefAttributes<HTMLInputElement>>NumericInputPropsinterface
@rentnerkev/inputs@rentnerkev/inputs/types@rentnerkev/inputs/numeric-input
export interface NumericInputProps extends Omit<BaseInputProps, 'value' | 'onChange'> {
value: number | null
onValueChange: (value: number | null) => void
}PackageInfointerface
@rentnerkev/inputs/ai
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
export interface PackageDocument {
path: string
content: string
}PackageApiinterface
@rentnerkev/inputs/ai
export interface PackageApi {
package: string
version: string
subpaths: Record<string, string>
declarations: PackageDocument[]
}PackageSearchMatchinterface
@rentnerkev/inputs/ai
export interface PackageSearchMatch {
path: string
line: number
text: string
}PackageExampleinterface
@rentnerkev/inputs/ai
export interface PackageExample {
language: string
code: string
}getPackageInfofunction
@rentnerkev/inputs/ai
export function getPackageInfo(): PackageInfogetPackageDocumentationfunction
@rentnerkev/inputs/ai
export function getPackageDocumentation(document?: 'readme' | 'usage'): PackageDocumentgetPackageApifunction
@rentnerkev/inputs/ai
export function getPackageApi(options?: {
subpath?: string
symbol?: string
}): PackageApisearchPackageDocumentationfunction
@rentnerkev/inputs/ai
export function searchPackageDocumentation(query: string): PackageSearchMatch[]getPackageExamplesfunction
@rentnerkev/inputs/ai
export function getPackageExamples(): PackageExample[]