Skip to main content
Version: latest
Works everywhere

Input works in both server and client environments. Always use the standard import (e.g. @prokodo/ui/input) — the library detects the runtime automatically.

Input

Input renders a styled <input> with an associated label, optional helper text below the field, error feedback, and support for leading/trailing adornments (icons or buttons).

Live demo →

Overview

import { Input } from "@prokodo/ui/input"
;<Input
name="email"
label="Email address"
type="email"
placeholder="you@example.com"
required
/>

Import

import { Input } from "@prokodo/ui/input"

CSS:

import "@prokodo/ui/input.css"

Props

PropTypeDefaultRequiredDescription
idstringHTML id for the input.
labelstringInput label text.
valuestringControlled input value.
defaultValuestringUncontrolled initial value.
placeholderstringPlaceholder text.
typestring"text"HTML input type.
disabledbooleanfalseDisable the input.
readOnlybooleanfalseMake input read-only.
requiredbooleanfalseMark field as required.
fullWidthbooleanfalseStretch to container width.
multilinebooleanfalseRender as <textarea>.
rowsnumberNumber of visible rows (textarea).
minRowsnumberMinimum rows for auto-resize textarea.
maxRowsnumberMaximum rows for auto-resize textarea.
startNodeReactNodeContent rendered at the start of the input.
endNodeReactNodeContent rendered at the end of the input.
renderNodeReactNodeCustom render override for the input node.
iconNamestringIcon name shown inside the input field.
errorTextstringError message (also sets error state).
helperTextstringHelper text shown below the input.
colorVariantsAccent color variant.
onChangeReact.ChangeEventHandler<HTMLInputElement>Change handler.
classNamestringCSS class on root element.

See src/components/input/Input.model.ts for the full InputProps type.


Design Tokens

Customise Input via CSS custom properties on :root or a scoped ancestor.

TokenDefaultDescription
--pk-input-bgvar(--pk-color-surface)Input background
--pk-input-fgvar(--pk-color-fg)Input text colour
--pk-input-fg-mutedvar(--pk-color-muted)Placeholder / hint text
--pk-input-bordervar(--pk-color-border)Resting border colour
--pk-input-border-focusvar(--pk-color-brand)Focused border colour
--pk-input-radiusvar(--pk-radius-pill)Corner radius
--pk-input-padding-xvar(--pk-space-lg)Horizontal padding
--pk-input-padding-y0.875remVertical padding
--pk-input-label-fgvar(--pk-color-muted)Resting label colour
--pk-input-label-focused-fgvar(--pk-color-brand)Floating label colour
--pk-input-helper-fgvar(--pk-palette-grey-300)Helper / error text colour
--pk-input-shadowvar(--pk-shadow-sm)Resting box-shadow
--pk-input-gradient-fromvar(--pk-color-brand)Focus-ring gradient start
--pk-input-gradient-tovar(--pk-color-accent)Focus-ring gradient end

AIC Note

Use the standard import path in application code:

import { Input } from "@prokodo/ui/input"

No separate /client or /lazy import selection is required in consumer code.

AIC components also support a priority flag for critical above-the-fold elements. This is most visible on Image (native preloading via <link rel="preload"> for above-the-fold content).


WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.3.5Identify Input Purpose (AA)🔍 Manual reviewForm fields collecting personal data must expose their purpose via the HTML autocomplete attribute.
2.1.1Keyboard (A)✅ FulfilledAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.7Focus Visible (AA)🔍 Manual reviewA visible keyboard focus indicator must be present on every interactive element. Verify against the applied product theme.
2.4.11Focus Not Obscured (Min.) (AA)🔍 Manual reviewThe focused component must not be fully hidden by sticky headers, overlays, or other positioned page elements.
3.3.1Error Identification (A)🔍 Manual reviewInput errors must be identified and described to the user in text, not by colour alone.
3.3.2Labels or Instructions (A)✅ FulfilledEvery form input requires a programmatically associated label or a visible instruction.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 6 jest-axe assertion(s) across 5 test file(s) · 7 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Input in Storybook


Source

src/components/input/Input.model.ts