@ea-lab/reactive-json-docs
Version:
Complete documentation for Reactive-JSON - Components, examples and LLM-parsable guides
71 lines (66 loc) • 2.19 kB
YAML
renderView:
- type: Markdown
content: |
# LabelFromValue
The `LabelFromValue` component displays the label associated with a value, using an option-like structure. It is useful for showing the display label of a value selected in a SelectField or any value/label mapping.
## Properties
- type: DefinitionList
content:
- term:
code: dataLocation
after: "(string, required)"
details: "Path to the value."
- term:
code: options
after: "(array, optional)"
details:
type: Markdown
content: "Array of `{label, value}` objects."
- term:
code: dynamicOptions
after: "(any, optional)"
details: "Template value for dynamic options."
- term:
code: defaultFieldValue
after: "(any, optional)"
details: "Default value if none is set."
- type: RjBuildDescriber
title: "Interactive Example: Display label from value"
description:
- type: Markdown
content: |
Select a status to see the corresponding label displayed below.
toDescribe:
renderView:
- type: SelectField
dataLocation: ~.status
label: "Status"
options:
- label: "Active"
value: 1
- label: "Inactive"
value: 2
- label: "Pending"
value: 3
- type: div
content:
- type: strong
content: "Label: "
- type: LabelFromValue
dataLocation: ~.status
options:
- label: "Active"
value: 1
- label: "Inactive"
value: 2
- label: "Pending"
value: 3
data:
status: 3
- type: Markdown
content: |
## Limitations
- Only the first matching label is displayed; duplicate values in options are not supported.
- No support for grouped options or nested structures.
- No built-in formatting for the label (use a wrapper if needed).
- If no options are provided, the raw value is shown.