## Overview

Displays a single attribute of a selected table entry dynamically. Prerequisite: There must be a table widget on the page.

The Connected Single Attribute Widget displays a single attribute value from an entity that is dynamically selected in a connected table or selection widget. Unlike the standard Single Attribute Widget which displays attributes from a fixed entity, this widget updates automatically when users select different rows in a connected table.

This widget implements the master-detail pattern by showing specific attribute values from entities selected in related table widgets, making it ideal for building interactive detail panels, quick edit interfaces, and responsive data exploration experiences.

## Use Cases

### Master-Detail View
Display detailed information about a selected table row. A table lists projects, and connected single attribute widgets show the selected project's status, owner, budget, and description in a detail panel. When users click different rows, all connected widgets update simultaneously.

### Quick Edit Interface
Allow inline editing of specific attributes from a selection. A table of tasks where selecting a task allows quick status updates via connected single attribute widgets with in-place editing enabled. Changes can trigger automatic reload of dependent widgets.

### Conditional Attribute Display
Show different attributes based on the selected entity's state. Display "Approval Date" only for approved items, or "Rejection Reason" only for rejected items using cplaceJS scripts for conditional visibility.

### Grouped Attributes Display
Multiple related attributes displayed together with a shared table selection. Embed multiple connected single attribute widgets within a Connected Attributes Group Widget to create a form-like interface showing multiple attributes from the selected entity.

### Inline Display in Rich Text
Embed dynamic attribute values within narrative content. A report page with text like "The selected project's current status is [status widget] and is owned by [owner widget]."

## Design Considerations

### Connected Widget Requirement
This widget requires a connection to a widget that produces single entity selections (implements `ISingleEntitySelectionProducer`). The most common source is the Embedded Search as Table widget. The widget starts with no target entity and updates based on user selections.

### Display Modes
The widget supports flexible display configurations:
- **Value only**: Displays just the attribute value, useful for inline embedding in sentences
- **Label only**: Shows only the attribute label, useful for headers or dynamic labels
- **Label and value**: Standard form field appearance with both elements
- **Stacked layout**: Label displayed above value, better for narrow layouts

### Embedding Contexts
The widget can be embedded in two contexts:
1. **Rich text content**: Directly in page content for inline displays
2. **Connected Attributes Group Widget**: For structured form-like interfaces where the parent widget manages the table connection

When embedded in a Connected Attributes Group, the parent widget controls the table selection for all embedded widgets, and its layout settings can override individual widget settings.

### In-Place Editing
When editing is enabled, users can modify attribute values directly without leaving the page. Consider enabling the reload-after-change option to refresh dependent widgets when values change.

### Conditional Visibility
The widget supports cplaceJS scripts that evaluate the current selection to determine whether the attribute should be displayed. This enables dynamic interfaces that adapt to the selected entity's state.

## Common Pitfalls

- Forgetting to specify the connected selection widget ID
- Not enabling at least one display option (value or label)
- Using this widget when a static Single Attribute Widget would suffice (no dynamic selection needed)
- Not considering the reload behavior after edits when other widgets depend on the edited values

## Alternatives to Consider

| Widget | When to Use Instead |
|--------|---------------------|
| **Single Attribute Widget** (`cf.platform.singleAttribute`) | When the entity is fixed and known at design time, not based on user selection |
| **Connected Attributes Group Widget** (`cf.cplace.platform.connectedAttributesGroup`) | When displaying multiple attributes together with shared table selection - use this as a container with embedded connected single attribute widgets |

## Related Patterns

- **Master-Detail Pattern**: Use with a table widget as the master and multiple connected single attribute widgets as the detail display
- **Quick Edit Interface**: Combine with in-place editing for efficient data updates from table selections
- **Dashboard Panels**: Create KPI displays based on filtered table selections using connected single attributes
