Docs
useInputValue
A hook to manage input values with useInputValue.
Loading...
Installation
pnpm dlx shadcn@latest add https://usekit.kiron.dev/k/use-input-value
Usage
"use client"
import * as React from "react"
import { useInputValue } from "@/hooks/use-input-value"
export function Component() {
const name = useInputValue("useKit")
return (
<div>
<input
style={{
borderRadius: "0.5rem",
backgroundColor: "rgba(229, 231, 235, 0.2)",
border: "1px solid rgba(229, 231, 235, 0.2)",
}}
{...name}
/>
<p>Hello, {name.value}!</p>
</div>
)
}
API Reference
Parameters
Name | Type | Description | Default Value | Optional |
---|---|---|---|---|
initial | string | number | boolean | null | undefined | The initial value of the input. | "" | Yes |
Return Values
Name | Type | Description |
---|---|---|
value | string | The current value of the input. |
onChange | React.ChangeEventHandler | The event handler to update the value of the input. |