Docyrus

Value Renderers

Read-only display components for Docyrus field values — tenant-aware dates / numbers, status companions, approval history, relation expand and more.

iOSAndroid
Preview Value Renderers on your device

Scan with Expo Go

Download Expo Go, then scan the QR code to preview native components.

Overview

Value renderers are read-only components that format a field value by type (web DynamicValue / VALUE_RENDERER_MAP parity). Every renderer accepts DocyValueProps; DocyValueDynamic 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() (DocyrusTenantProvider), 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

pnpm dlx @docyrus/cli add @docyrus/rn-value-renderers

Usage

import { DocyValueDynamic } from '@/components/docyrus-native/value-renderers';

<DocyValueDynamic
  field={{ id: 'stage', slug: 'stage', name: 'Stage', type: 'field-status' }}
  value={record.stage}
  record={record}
  enumOptions={stageOptions} />

<DocyValueDynamic
  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

DocyValueProps

PropTypeDefaultDescription
fieldIField—Field definition (required)
valueunknown—Value to display (required)
recordRecord<string, unknown>—Full record — companion columns (__<slug>_currency, __<slug>_country, __<slug>_secondary, __<slug>_description, __<slug>_followup_date)
enumOptionsEnumOption[]—Options for select-based fields
size'sm' | 'md' | 'lg''md'Size scale (native)
uuidbooleanfalseIdentity: 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)
expandIconReactNode—Custom expand glyph
onComposeEmail(email: string) => void—Email: open the app composer instead of mailto:
onSendMessage(phone: string) => void—Phone: send-message button
clientRestApiClient—Email: compose button opening EmailComposeDialog. Phone: message button opening InstantMessageComposeDialog. onComposeEmail / onSendMessage win when set
classNamestring—Container class
textClassNamestring—Text class (native)

Field type → renderer (VALUE_RENDERER_MAP)

TypesRenderer
field-text, -textarea, -display, -codeDocyValueText
field-passwordDocyValuePassword (masked + eye toggle)
field-number / -percent / -money / -duration / -ratingNumber / Percent / Money / Duration / Rating (field.maxRating)
field-checkbox / -switchCheckbox / Switch
field-email / -phone / -urlEmail / Phone / Url
field-color / -icon / -currencyColor / Icon / CurrencyCode
field-select, -enum, -systemEnumDocyValueSelect
field-multiSelect, -tagSelectDocyValueMultiSelect
field-radioGroup / -status / -approvalStatus / -listRadioGroup / Status / ApprovalStatus / List
field-userSelect / -userMultiSelect / -relationUser / UserMulti / Relation
field-date / -dateTime / -time / -dateRangeDate / Datetime / Time / DateRange
field-file / -image / -avatarFile / Image / Avatar
field-htmlEditor, -emailEditorDocyValueRichText
field-markdownDocyValueMarkdown
field-codeEditor, -jsonata, -handlebarsDocyValueCode
field-docEditorDocyValueDocEditor (Plate JSON → preview text)
field-json, -jsonSchema, -queryBuilder, -inlineFormDocyValueJson
field-adaptiveCardDocyValueAdaptiveCard (summary)
field-inlineData, -schemaRepeater, -systemBuffer, -systemVector, -systemTextArray, -systemUuidArrayDocyValueInlineData
field-taskList / -todo / -locationSelectTaskList / Todo / Location
field-conversationChannel / -fileStorageFolderConversationChannel / FileStorageFolder
field-button / -formula / -relatedFieldButton / Formula / RelatedField
field-identity, -autonumberDocyValueIdentity

Notable renderers

DocyValueStatus

Solid primary badge, the sub-status (__<slug>_secondary), notes (__<slug>_description) and follow-up date (__<slug>_followup_date, tenant date format).

DocyValueApprovalStatus

Status badge, last-response summary (actor avatar, time, comments) and response history. Bare status strings and the legacy array-of-steps shape are supported.

DocyValueRelation

Resolves an expanded { id, name } object or an id via enumOptions; onExpand / renderExpandContent add a trailing expand button (content opens in a bottom sheet).

DocyValueIdentity

# + id; uuid mode shows a compact chip that reveals the id on press. onCopy is called on long-press.

DocyValueImage / DocyValueFile

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.

DocyValueDocEditor

Parses the persisted Plate JSON into a single preview line (80 chars); plain text / HTML still accepted.

DocyValueMarkdown / DocyValueAdaptiveCard / DocyValuePassword

Markdown via the shared renderer; adaptive cards as 3 elements · 1 action; passwords masked by default.

Utilities

ExportDescription
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, shouldRenderEnumOptionChipEnum color helpers
formatDuration, formatMoney, formatDateRange, formatTime, formatPhoneDisplay, getCompanionValue, getCompanionFieldSlug, getCurrencySymbol, parseDateRange, COMMON_CURRENCIESFormatting helpers
DocyValueEmpty, getValueSizeConfigEmpty placeholder + size scale
VALUE_RENDERER_MAPType → renderer registry

Components

ComponentDescription
DocyValueDynamicDispatches on field.type
DocyValueText, DocyValuePassword, DocyValueNumber, DocyValuePercent, DocyValueMoney, DocyValueDuration, DocyValueRatingText & numbers
DocyValueCheckbox, DocyValueSwitchBooleans
DocyValueEmail, DocyValuePhone, DocyValueUrl, DocyValueColor, DocyValueIcon, DocyValueCurrencyCodeContact & appearance
DocyValueSelect, DocyValueMultiSelect, DocyValueStatus, DocyValueRadioGroup, DocyValueUser, DocyValueUserMulti, DocyValueRelation, DocyValueApprovalStatus, DocyValueList, DocyValueConversationChannel, DocyValueFileStorageFolder, DocyValueRelatedField, DocyValueIdentitySelection
DocyValueDate, DocyValueDatetime, DocyValueTime, DocyValueDateRangeDates
DocyValueFile, DocyValueImage, DocyValueAvatarFiles
DocyValueCode, DocyValueJson, DocyValueRichText, DocyValueDocEditor, DocyValueMarkdown, DocyValueAdaptiveCard, DocyValueTaskList, DocyValueTodo, DocyValueInlineData, DocyValueButton, DocyValueFormula, DocyValueLocationComplex

Type Exports

TypeDescription
DocyValuePropsRenderer props
DocyValueRelationItem{ id; name? } handed to expand callbacks
IField, IFieldType, EnumOptionField contract
ValueDateKind'date' | 'datetime' | 'time'

Breaking changes (web-parity release)

  • Dates render in the tenant / locale format; DocyValueNumber / Percent / Money use the tenant number format when a provider is mounted.
  • field-autonumber renders with DocyValueIdentity; field-code with DocyValueText (web parity).
  • DocyValueApprovalStatus shows uppercase workflow statuses plus summary / history.
  • Emoji glyphs replaced by DocyrusIcon icons.

On this page