FormsInteractive playground
Input
Text input with sizes, validation and masks.
Preparing the playground…
Text and Markdown example
Input · Example
1<div style={{ display: "grid", gap: 16, width: "100%", maxWidth: 360 }}>
2 <Label htmlFor="demo-email">Email</Label><Input id="demo-email" type="email" placeholder="[email protected]" />
3</div>How to use it
Associate a label using htmlFor and id. Use invalid for the visual error state and aria-describedby to explain how to fix it.
Import
React / Next.js
1import { Input } from "@kivora/nextjs";Interactive examples run inside a component with "use client". The playground's Copy button includes the imports needed for the current example.
API reference 0.2.0
Types from the installed published version, including component properties and common HTML attributes. “Optional” does not imply a default value; omitting a property lets the component decide.
| Property | Type | Description |
|---|---|---|
alt | string | Alternative text for the image. |
aria-label | string | Accessible name of the control. |
autoComplete | HTMLInputAutoCompleteAttribute | Tell the browser which autocomplete type to use. |
checked | boolean | Controlled selection state. |
children | ReactNode | Content or child elements of the component. |
className | string | Additional CSS classes to customize the element. |
defaultChecked | boolean | Initial selection of the control. |
defaultValue | string | number | readonly string[] | Initial value when the component manages its own state. |
definitions | Record<string, RegExp> | Configures definitions. The type describes the supported values and structure. |
disabled | boolean | Disable interaction with the control. |
id | string | Element identifier; associates labels and descriptions. |
invalid | boolean | Enable the visual error state. |
lazy | boolean | Configures lazy. The type describes the supported values and structure. |
mask | string | RegExp | Mask or regular expression applied to input. |
max | string | number | Maximum allowed value. |
maxLength | number | Maximum number of characters. |
min | string | number | Minimum allowed value. |
name | string | Name used to identify the control in forms. |
onAccept | ((value: string, maskRef: unknown, event?: InputEvent) => void) | Receives changes accepted by the mask. |
onChange | ChangeEventHandler<HTMLInputElement, HTMLInputElement> | Change event. Check the type: some controls return an object, others a DOM event. |
onClick | MouseEventHandler<HTMLInputElement> | Action performed when the element is activated. |
onComplete | ((value: string, maskRef: unknown, event?: InputEvent) => void) | Callback when input or an operation is complete. |
onSubmit | SubmitEventHandler<HTMLInputElement> | Form submission event. |
overwrite | boolean | Configures overwrite. The type describes the supported values and structure. |
placeholder | string | Short hint displayed when there is no value. |
placeholderChar | string | Configures placeholderChar. The type describes the supported values and structure. |
required | boolean | Indicates that a value is required. |
role | AriaRole | Semantic role of the element. Keep the default role unless a change is justified. |
size | "default" | "sm" | "lg" | null | Visual size of the component. |
src | string | Resource path or URL. |
step | string | number | Increment between values. |
style | CSSProperties | React inline styles. |
tabIndex | number | Keyboard focus order and availability. |
title | string | Title or supplementary information. |
type | HTMLInputTypeAttribute | Operation type or mode; values depend on the component. |
unmask | boolean | "typed" | Control the format of the value returned by the mask. |
value | string | number | readonly string[] | Controlled value. Update it from the change callback. |
TypeScript definition
Review each component's properties and published declaration. Native and accessibility attributes are inherited from the element specified by its type.
Input37 properties
Input · TypeScript
1Input: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>API generated from @kivora/nextjs 0.2.0View package