# rn-value-renderers URL: /docs/native/kiva/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 to `Intl.NumberFormat`. - Select-style values accept an id **or** an expanded `{ id, name }` object. - Enum options with both `icon` and `color` render as a solid chip with WCAG-contrast text. ## Installation ```bash pnpm dlx @kivacore/ui-cli add @kivacore/rn-value-renderers ``` ## Usage ```tsx import { KivaValueDynamic } from '@/components/kiva-native/value-renderers'; 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` | — | Full record — companion columns (`___currency`, `___country`, `___secondary`, `___description`, `___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 [rn-email-compose-dialog](/docs/native/kiva/email-compose-dialog). Phone: message button opening [rn-instant-message-compose-dialog](/docs/native/kiva/instant-message-compose-dialog). `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 (`___secondary`), notes (`___description`) and follow-up date (`___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` / `Money` use the tenant number format when a provider is mounted. - `field-autonumber` renders with `KivaValueIdentity`; `field-code` with `KivaValueText` (web parity). - `KivaValueApprovalStatus` shows uppercase workflow statuses plus summary / history. - Emoji glyphs replaced by `KivaIcon` icons.