Value Renderers
Read-only display components for Kiva field values — tenant-aware dates / numbers, status companions, approval history, relation expand and more.
Overview
Value renderers are read-only components that format a field value by type (web DynamicValue / VALUE_RENDERER_MAP parity). Every renderer accepts KivaValueProps; KivaValueDynamic picks the renderer from field.type (unmapped types fall back to text).
- Dates, date-times, date ranges and status follow-up dates use the tenant format from
useDateFormat()(KivaTenantProvider), falling back to the device locale — never raw ISO strings. - Numbers, percents and money use
useNumberFormat(), falling back toIntl.NumberFormat. - Select-style values accept an id or an expanded
{ id, name }object. - Enum options with both
iconandcolorrender as a solid chip with WCAG-contrast text.
Installation
pnpm dlx @kivacore/ui-cli add @kivacore/rn-value-renderersUsage
import { KivaValueDynamic } from '@/components/kiva-native/value-renderers';
<KivaValueDynamic
field={{ id: 'stage', slug: 'stage', name: 'Stage', type: 'field-status' }}
value={record.stage}
record={record}
enumOptions={stageOptions} />
<KivaValueDynamic
field={{ id: 'account', slug: 'account', name: 'Account', type: 'field-relation' }}
value={{ id: 'acc-1', name: 'Acme' }}
onExpand={item => router.push(`/accounts/${item.id}`)} />API Reference
KivaValueProps
| Prop | Type | Default | Description |
|---|---|---|---|
field | IField | — | Field definition (required) |
value | unknown | — | Value to display (required) |
record | Record<string, unknown> | — | Full record — companion columns (__<slug>_currency, __<slug>_country, __<slug>_secondary, __<slug>_description, __<slug>_followup_date) |
enumOptions | EnumOption[] | — | Options for select-based fields |
size | 'sm' | 'md' | 'lg' | 'md' | Size scale (native) |
uuid | boolean | false | Identity: compact # chip; press reveals, long-press calls onCopy |
onCopy | (text: string) => void | — | Identity copy handler (wire expo-clipboard) |
onExpand | (item: { id; name? }) => void | — | Relation expand button |
renderExpandContent | (item: { id; name? }) => ReactNode | — | Relation expand content (bottom sheet) |
expandIcon | ReactNode | — | Custom expand glyph |
onComposeEmail | (email: string) => void | — | Email: open the app composer instead of mailto: |
onSendMessage | (phone: string) => void | — | Phone: send-message button |
client | RestApiClient | — | Email: compose button opening EmailComposeDialog. Phone: message button opening InstantMessageComposeDialog. onComposeEmail / onSendMessage win when set |
className | string | — | Container class |
textClassName | string | — | Text class (native) |
Field type → renderer (VALUE_RENDERER_MAP)
| Types | Renderer |
|---|---|
field-text, -textarea, -display, -code | KivaValueText |
field-password | KivaValuePassword (masked + eye toggle) |
field-number / -percent / -money / -duration / -rating | Number / Percent / Money / Duration / Rating (field.maxRating) |
field-checkbox / -switch | Checkbox / Switch |
field-email / -phone / -url | Email / Phone / Url |
field-color / -icon / -currency | Color / Icon / CurrencyCode |
field-select, -enum, -systemEnum | KivaValueSelect |
field-multiSelect, -tagSelect | KivaValueMultiSelect |
field-radioGroup / -status / -approvalStatus / -list | RadioGroup / Status / ApprovalStatus / List |
field-userSelect / -userMultiSelect / -relation | User / UserMulti / Relation |
field-date / -dateTime / -time / -dateRange | Date / Datetime / Time / DateRange |
field-file / -image / -avatar | File / Image / Avatar |
field-htmlEditor, -emailEditor | KivaValueRichText |
field-markdown | KivaValueMarkdown |
field-codeEditor, -jsonata, -handlebars | KivaValueCode |
field-docEditor | KivaValueDocEditor (Plate JSON → preview text) |
field-json, -jsonSchema, -queryBuilder, -inlineForm | KivaValueJson |
field-adaptiveCard | KivaValueAdaptiveCard (summary) |
field-inlineData, -schemaRepeater, -systemBuffer, -systemVector, -systemTextArray, -systemUuidArray | KivaValueInlineData |
field-taskList / -todo / -locationSelect | TaskList / Todo / Location |
field-conversationChannel / -fileStorageFolder | ConversationChannel / FileStorageFolder |
field-button / -formula / -relatedField | Button / Formula / RelatedField |
field-identity, -autonumber | KivaValueIdentity |
Notable renderers
KivaValueStatus
Solid primary badge, the sub-status (__<slug>_secondary), notes (__<slug>_description) and follow-up date (__<slug>_followup_date, tenant date format).
KivaValueApprovalStatus
Status badge, last-response summary (actor avatar, time, comments) and response history. Bare status strings and the legacy array-of-steps shape are supported.
KivaValueRelation
Resolves an expanded { id, name } object or an id via enumOptions; onExpand / renderExpandContent add a trailing expand button (content opens in a bottom sheet).
KivaValueIdentity
# + id; uuid mode shows a compact chip that reveals the id on press. onCopy is called on long-press.
KivaValueImage / KivaValueFile
Accept StoredFileValue, URL strings and arrays. Images render a gallery strip (4 + +N) for arrays; files show the basename of file_name and the size.
KivaValueDocEditor
Parses the persisted Plate JSON into a single preview line (80 chars); plain text / HTML still accepted.
KivaValueMarkdown / KivaValueAdaptiveCard / KivaValuePassword
Markdown via the shared renderer; adaptive cards as 3 elements · 1 action; passwords masked by default.
Utilities
| Export | Description |
|---|---|
extractEnumId(value) / extractEnumLabel(value) | Id / label from a primitive or expanded object |
useValueDateFormatter(kind) | Tenant-aware date / datetime / time formatter |
useValueNumberFormatter(fallback?) | Tenant-aware number formatter |
parseValueDate(value) | Date parser (date-only strings are local days) |
docEditorPreviewText(value) | Plate JSON → preview text |
getEnumBadgeColors, getEnumColorValue, shouldRenderEnumOptionChip | Enum color helpers |
formatDuration, formatMoney, formatDateRange, formatTime, formatPhoneDisplay, getCompanionValue, getCompanionFieldSlug, getCurrencySymbol, parseDateRange, COMMON_CURRENCIES | Formatting helpers |
KivaValueEmpty, getValueSizeConfig | Empty placeholder + size scale |
VALUE_RENDERER_MAP | Type → renderer registry |
Components
| Component | Description |
|---|---|
KivaValueDynamic | Dispatches on field.type |
KivaValueText, KivaValuePassword, KivaValueNumber, KivaValuePercent, KivaValueMoney, KivaValueDuration, KivaValueRating | Text & numbers |
KivaValueCheckbox, KivaValueSwitch | Booleans |
KivaValueEmail, KivaValuePhone, KivaValueUrl, KivaValueColor, KivaValueIcon, KivaValueCurrencyCode | Contact & appearance |
KivaValueSelect, KivaValueMultiSelect, KivaValueStatus, KivaValueRadioGroup, KivaValueUser, KivaValueUserMulti, KivaValueRelation, KivaValueApprovalStatus, KivaValueList, KivaValueConversationChannel, KivaValueFileStorageFolder, KivaValueRelatedField, KivaValueIdentity | Selection |
KivaValueDate, KivaValueDatetime, KivaValueTime, KivaValueDateRange | Dates |
KivaValueFile, KivaValueImage, KivaValueAvatar | Files |
KivaValueCode, KivaValueJson, KivaValueRichText, KivaValueDocEditor, KivaValueMarkdown, KivaValueAdaptiveCard, KivaValueTaskList, KivaValueTodo, KivaValueInlineData, KivaValueButton, KivaValueFormula, KivaValueLocation | Complex |
Type Exports
| Type | Description |
|---|---|
KivaValueProps | Renderer props |
KivaValueRelationItem | { id; name? } handed to expand callbacks |
IField, IFieldType, EnumOption | Field contract |
ValueDateKind | 'date' | 'datetime' | 'time' |
Breaking changes (web-parity release)
- Dates render in the tenant / locale format;
KivaValueNumber/Percent/Moneyuse the tenant number format when a provider is mounted. field-autonumberrenders withKivaValueIdentity;field-codewithKivaValueText(web parity).KivaValueApprovalStatusshows uppercase workflow statuses plus summary / history.- Emoji glyphs replaced by
KivaIconicons.