Skip to main content
Version: latest
Works everywhere

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

DynamicList

DynamicList renders a repeatable set of input rows that users can add or remove at runtime. Ideal for managing arrays of values inside forms (e.g. phone numbers, addresses, tags).

Live demo →

Overview

import { DynamicList } from "@prokodo/ui/dynamic-list"
;<DynamicList
label="Phone numbers"
name="phones"
value={phones}
onChange={setPhones}
renderItem={(item, onChange) => (
<Input value={item} onChange={e => onChange(e.target.value)} />
)}
/>

Import

import { DynamicList } from "@prokodo/ui/dynamic-list"

CSS:

import "@prokodo/ui/dynamic-list.css"

Props

PropTypeDefaultRequiredDescription
fieldsDynamicListField[]Field definitions for each row.
valueRecord<string, unknown>[]Controlled list of row values.
namestringName for hidden form input.
labelstringLabel text shown above the list.
labelPropsLabelPropsProps forwarded to the label element.
disabledbooleanfalseDisable all interactions.
requiredbooleanfalseMark field as required.
errorTextstringError message shown below the list.
helperTextstringHelper text shown below the list.
colorVariantsAccent color variant.
buttonAddPropsButtonPropsProps for the "Add row" button.
buttonDeletePropsButtonPropsProps for each "Delete row" button.
classNameListstringCSS class on the list wrapper.
onChange(rows: Record<string, unknown>[]) => voidCalled when rows change.
classNamestringCSS class on root element.

See src/components/dynamic-list/DynamicList.model.ts for the full DynamicListProps type.


Design Tokens

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

TokenDefaultDescription
--pk-dynamic-list-label-mbvar(--pk-space-md)Label bottom margin
--pk-dynamic-list-gapvar(--pk-space-lg)Gap between list items
--pk-dynamic-list-field-mbvar(--pk-space-lg)Field bottom margin
--pk-dynamic-list-helper-fgvar(--pk-palette-grey-300)Helper text colour
--pk-dynamic-list-error-fgvar(--pk-color-error)Error text colour

AIC Note

Use the standard import path in application code:

import { DynamicList } from "@prokodo/ui/dynamic-list"

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)🔍 Manual reviewAll functionality must be operable via keyboard alone, without requiring specific timing.
2.1.2No Keyboard Trap (A)🔍 Manual reviewKeyboard focus must never become trapped inside a component; users must always be able to navigate away using standard keys.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
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.
4.1.3Status Messages (AA)✅ FulfilledStatus messages (loading, success, error, progress) must reach assistive technologies without a focus change (aria-live or role='status').

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

Storybook

👉 Open DynamicList in Storybook


Source

src/components/dynamic-list/DynamicList.model.ts