Skip to main content
Back to React

<ConsentDetailField />

The ConsentDetailField component renders the value of one field of an RFC 9396 authorization detail on the consent step. It renders the value only, so render the field's label next to it. A field the user may change, as the field policy of the detail's type allows, renders as an input. Every other field is read-only. <ConsentAuthorizationDetail /> renders it for each field by default.

Usage​

tsx
<ConsentDetailField
purposeId={purpose.purposeId}
detailId={element.name}
row={row}
formValues={formValues}
onInputChange={onInputChange}
/>

See <ConsentAuthorizationDetail /> for a complete example.

Field Behavior​

The field's modification sets what the user may do:

modificationRendersThe user may
decreaseA number or date inputEnter a value up to the value shown
increaseA number or date inputEnter a value from the value shown upward
removeItemsOne button per itemRemove items, except the last one kept, and add removed items back
addItemsThe items shown, and a button for each item the type allowsAdd the allowed items, and remove the ones they added
NoneThe value as textNothing

A field renders read-only text instead when its value does not fit its modification: a decrease or increase field that is neither a number nor a date in YYYY-MM-DD form (a dateTime field is never editable), a removeItems list with fewer than two items, or a removeItems or addItems list whose items are not all strings, numbers, or booleans. An addItems list whose type lists no allowed values also shows a text input that adds a typed item when the user presses Enter.

A value the user enters outside its bound, or text that is not a number or a date, shows an error such as Enter 120 or less. The field then submits no change and marks itself invalid, which blocks approval through isApprovalBlocked until the user corrects it or declines the detail. The server checks every change it receives against the field policy.

Props​

PropTypeRequiredDescription
purposeIdstring✅The purposeId of the authorization details purpose.
detailIdstring✅The name of the detail's element.
rowConsentDetailRow✅The field to render.
formValuesRecord<string, string>✅The consent form values.
onInputChange(name: string, value: string) => void✅Called with a form key and its new value.
align'start' | 'end'❌Side the value aligns to. Defaults to 'end'.
children(field: UseConsentDetailFieldResult) => ReactNode❌Render-props callback that replaces the default UI. It receives the field's state from useConsentDetailField().
tUseTranslation['t']❌Translation function for the error messages and button labels.

ConsentDetailRow​

PropertyTypeDescription
pathstringDot-separated location of the field in the detail, such as instructedAmount.amount
labelstringThe field's title from the type's schema, or its path when the schema gives none
valueunknownThe field's value in the requested detail
modificationConsentDetailModification ('none' | 'decrease' | 'increase' | 'removeItems' | 'addItems')The change the user may make. Absent, or 'none', for a read-only field
as'number' | 'date' | 'dateTime'How a field with a modification is compared. Present only with decrease or increase
optionsunknown[]The values the type allows in an addItems list
originstring'server' when the type's processor supplied the value

Explore with AI

ThunderID LogoThunderID Logo

Product

DocsAPIsSDKs
© Copyright Linux Foundation Europe.For web site terms of use, trademark policy and other project policies please see https://linuxfoundation.eu/en/policies.