Components

Value Renderers

Read-only value display system for table cells, detail views, and kanban cards. 44 renderer types with automatic dispatch via DynamicValue.

Client Only

Installation

pnpm dlx @docyrus/cli add @docyrus/ui-value-renderers
UI Primitives(3 components)
npx shadcn@latest add avatar badge button

Usage

import { DynamicValue } from '@docyrus/ui/components/value-renderers';
import type { IField, DocyrusValueProps } from '@docyrus/ui/components/value-renderers';

const fields: IField[] = [
  { id: '1', name: 'Full Name', slug: 'full_name', type: 'field-text' },
  { id: '2', name: 'Priority', slug: 'priority', type: 'field-select' },
  { id: '3', name: 'Status', slug: 'status', type: 'field-status' },
];

const record = {
  full_name: 'Erhan ERDOGAN',
  priority: 'high',
  status: 'in_progress',
  __status_description: 'Working on API',
};

const enumOptions = [
  { id: 'low', name: 'Low', color: '#22c55e' },
  { id: 'medium', name: 'Medium', color: '#f59e0b' },
  { id: 'high', name: 'High', color: '#ef4444' },
];

function RecordDetail() {
  return (
    <div>
      {fields.map((field) => (
        <DynamicValue
          key={field.id}
          field={field}
          value={record[field.slug]}
          record={record}
          enumOptions={field.type === 'field-select' ? enumOptions : undefined}
        />
      ))}
    </div>
  );
}

Individual Import

You can import individual renderers to reduce bundle size:

import { TextValue } from '@docyrus/ui/components/value-renderers/text-value';
import { SelectValue } from '@docyrus/ui/components/value-renderers/select-value';
import { StatusValue } from '@docyrus/ui/components/value-renderers/status-value';

Renderer Types

Text & Content

TypeComponentDescription
field-textTextValuePlain text display
field-textareaTextValueMulti-line text (shared renderer)
field-displayTextValueDisplay-only text (shared renderer)
field-codeTextValueCode snippet display (shared renderer)
field-codeEditorCodeValueCode block with monospace font
field-htmlEditorRichTextValueRendered HTML content
field-emailEditorRichTextValueEmail template preview
field-docEditorDocEditorValueDocument content preview
field-jsonJsonValueJSON display with formatting
field-formulaFormulaValueFormula expression display
field-relatedFieldRelatedFieldValueRelated field value display

Numbers

TypeComponentDescription
field-numberNumberValueFormatted number display
field-moneyMoneyValueCurrency-formatted amount
field-percentPercentValuePercentage display
field-durationDurationValueDuration in HH:MM:SS format
field-ratingRatingValueStar rating display
field-currencyCurrencyCodeValueCurrency code with symbol

Selection

TypeComponentDescription
field-selectSelectValueBadge with color/icon
field-radioGroupSelectValueBadge display (shared renderer)
field-enumSelectValueBadge display (shared renderer)
field-multiSelectMultiSelectValueMultiple badges
field-tagSelectMultiSelectValueTag badges (shared renderer)
field-statusStatusValueStatus badge with description + follow-up date
field-approvalStatusApprovalStatusValueApproval workflow badge
field-listListValueList item badge

Date & Time

TypeComponentDescription
field-dateDateValueLocalized date display
field-dateTimeDateTimeValueLocalized date + time display
field-timeTimeValueLocalized time display
field-dateRangeDateRangeValueDate range with separator

Toggle

TypeComponentDescription
field-checkboxCheckboxValueCheck/X icon indicator
field-switchSwitchValueOn/Off text indicator

Users & Relations

TypeComponentDescription
field-userSelectUserValueUser avatar with name
field-userMultiSelectUserMultiValueStacked user avatars
field-relationRelationValueRelated record link

Contact

TypeComponentDescription
field-emailEmailValueEmail link with icon
field-phonePhoneValuePhone with country code
field-urlUrlValueURL link with hostname

Visual

TypeComponentDescription
field-colorColorValueColor swatch supporting hex and Tailwind color tokens
field-iconIconValueRendered Docyrus icon string such as huge ai-brain-03

Files & Media

TypeComponentDescription
field-fileFileValueFile name with icon
field-imageImageValueSingle image thumbnail or gallery thumbnail group
field-avatarAvatarValueAvatar thumbnail

Structure

TypeComponentDescription
field-taskListTaskListValueChecklist progress
field-todoTodoValueTodo item count
field-inlineDataInlineDataValueInline data row count
field-locationSelectLocationValueAddress with map pin

System

TypeComponentDescription
field-identityIdentityValueIdentity hash display
field-autonumberIdentityValueAuto-number display
field-buttonButtonValueAction button label
field-conversationChannelConversationChannelValueChannel name
field-fileStorageFolderFileStorageFolderValueFolder name

API Reference

DynamicValue

Dispatcher component that renders the correct value renderer based on field.type.

Notes:

  • ColorValue accepts hex values and Tailwind-style tokens such as emerald-500.
  • IconValue expects a Docyrus icon string, for example huge ai-brain-03.
  • ImageValue accepts either a single { file_name, signed_url } object or an array of those objects for gallery-style output.
<DynamicValue
  field={fieldConfig}
  value={record[fieldConfig.slug]}
  record={record}
  enumOptions={options}
  className="my-value"
/>

DocyrusValueProps

All value renderer components share this interface:

PropTypeDefaultDescription
fieldIField—Field configuration from the data source
valueunknown—The field value to display
recordRecord<string, unknown>—Full record for accessing companion columns
enumOptionsEnumOption[][]Options for select-based fields
classNamestring—Additional CSS class

IField

FieldTypeDescription
idstringUnique field identifier
namestringDisplay label
slugstringRecord key for accessing the value
typeIFieldTypeField type — determines which renderer is used
defaultValuestring | nullDefault value
validationsstring[] | nullValidation rules
readOnlyboolean | nullRead-only flag

EnumOption

FieldTypeDescription
idstringOption identifier
namestringDisplay label
colorstringColor indicator (hex)
iconstringDocyrus icon name
slugstringSlug value
sort_ordernumberDisplay order

On this page