Behavior
This page describes runtime behavior that every theme must respect. If you are unsure how a prop behaves, check here before guessing.
Accessibility contract
ariaLabelledByandariaDescribedByare already-composed, space-separated id strings. Attach them verbatim to the focusable element.Labelreceivesidfor the label element. Apply it to the element that wraps the visible label text so controls can reference it viaaria-labelledby.- When
idis provided, set it on the primary focusable element. For composite widgets, pick the element that receives keyboard focus. ariaDescribedByreferences renderedHelpandErrorsids. Keep those elements in the DOM when you render them.- Legal and flyover content is not included in
ariaDescribedByby default. Keep those controls accessible in your layout. - For
TabContainer, follow the WAI-ARIA tab pattern:role="tablist"on the container,role="tab"on each tab withid={buttonId},role="tabpanel"on each panel withid={panelId}, and wirearia-controlsandaria-labelledby. - For custom select or multiselect widgets, follow combobox/listbox roles and keyboard interactions (Arrow keys, Enter or Space to select, Escape to close) when you are not using native inputs.
Controlled values
All inputs are controlled; callbacks receive values, not DOM events.
- TextInput and TextArea: pass the raw string. Empty string stays empty string.
- NumberInput, SpinnerInput, SliderInput: parse to
numberorundefined. Useundefinedwhen the field is empty or invalid. - DateInput, DateTimeInput, TimeInput: treat the value as an opaque string and return it as entered. Do not normalize, format, or shift timezones.
- Select and Radio:
selectedOption = undefinedmeans no selection. CallonChange(token | undefined)when the selection changes. - CheckboxList and MultiSelect: treat
selectedOptions[].tokenas the selected set. CallonSelectoronDeselectonce per user action and do not reorder the provided selections.
Disabled behavior
- When
disabledis true, render the UI as disabled and suppress all callbacks. - Native inputs: use the
disabledattribute. - Custom widgets: set
aria-disabled="true", remove from the tab order (tabIndex={-1}), and ignore pointer and keyboard events. - Disabled options should remain visible and announced as disabled.
- If an add or remove action is provided with
canAdd={false}orcanRemove={false}, render it disabled rather than hiding it.
Options and custom options lifecycle
- Tokens are stable for a given option or selection; it is safe to use them as React keys.
SelectedOptionItem.labelmay not match the current options list (legacy or custom values). Render it as provided.- The renderer may include disabled legacy options in
optionsto keep stored answers visible. Treat them as normal options, but disabled. specifyOtherOptionis an extra option row. When the user selects it, the renderer enters a custom-entry state and providescustomOptionForm.customOptionFormis present only while custom entry is active. Render it near the options list or in place of it. UseonSubmitto commit andonCancelto return to the list; respectcanSubmitwhen rendering submit controls.isLoadingcan be true while options fetch. The renderer may also renderOptionsLoadingin the question scaffold; handle both without duplicating spinners.orientationonRadioButtonListandCheckboxListis optional. When provided, use it to switch between horizontal and vertical layouts.
Repeating items contract
AnswerListrenders one or moreAnswerScaffoldentries; whenonAddis provided it should render add-answer controls.AnswerScaffold.onRemoveis provided for repeating questions. Render a remove action next to the control and disable it whencanRemoveis false.AnswerScaffold.errorsis provided for per-answer validation; render it near the answer content.GroupListrenders a list of group instances (GroupScaffold) and can show an add control whenonAddis provided.GroupScaffoldshould render a remove action whenonRemoveis provided; usecanRemoveto disable it.
Strings and localization
useStrings()returns translation strings for the currently selected language.- Use those strings instead of hardcoding text to make your themes multilingual.
