## Overview

Output of the value of an attribute. The Single Attribute widget displays one specific attribute from a page with fine-grained control over its presentation. Unlike the full Attributes widget that shows all attributes, this widget focuses on a single attribute with maximum configuration flexibility, including custom labels, in-place editing, and conditional visibility based on business logic.

## Use Cases

### Custom Attribute Layout

Display specific attributes in a custom page layout without showing all attributes. Create summary sections at the top of pages showing only critical attributes (status, priority, owner) while keeping detailed attributes in separate sections.

### Quick Edit Interface

Enable rapid editing of specific attributes without opening full edit forms. Allow users to quickly update task status or priority directly from a page view, reducing clicks and page transitions.

### Read-Only Display with Alternative Labels

Show attribute values with custom, user-friendly labels instead of technical attribute names. Display a technical attribute like an internal code with a friendlier label for business users, with multi-language support.

### Conditional Attribute Display

Show or hide attributes based on dynamic conditions using cplaceJS scripts. Display "Rejection Reason" only when a request's status is "Rejected", or show "Approval Date" only for approved items.

### Parent Page Attribute Display

Display attributes from a parent page in hierarchical structures. Show project-level attributes on task pages without duplicating data across the hierarchy.

### Value-Only Display

Show attribute values without labels in compact layouts. Display status badges, icons, or values in dense UIs where labels would be redundant.

### Building Block for Complex Forms

Use as a building block within Attributes Group widgets to create custom multi-column forms with precise attribute placement and mixed widget types.

## Design Considerations

### Display Mode Options

The widget supports three primary display modes:
- **Label and Value**: Standard display showing both the attribute name and its current value
- **Value Only**: Clean rendering without labels for compact layouts
- **Label Only**: Show just the attribute name without its value

At least one of label or value must be shown - the widget validates this requirement.

### In-Place Editing

When enabled, in-place editing allows users to modify attribute values directly in the display without form submission. Consider enabling the reload option if other widgets on the page depend on the edited attribute's value.

### Conditional Visibility Scripts

The visibility script receives two bindings:
- `targetEntity`: The entity whose attribute is displayed
- `embeddingPage`: The page where the widget is embedded

The script should return a boolean - returning `false` hides the attribute.

### Layout Control

The single-column option controls whether the attribute displays in full-width or two-column layout. This setting is only relevant when showing the label.

When embedded within an Attributes Group widget, layout settings are inherited from the parent widget.

## Alternatives

| Scenario | Recommended Widget |
|----------|-------------------|
| Display all attributes | `cf.platform.attributes` |
| Multiple attributes with custom layout | `cf.cplace.platform.attributesGroup` |
| Attribute from selected table row | `cf.platform.connectedSingleAttribute` |
| Simple default display | `cf.platform.attributes` |

## Common Pitfalls

- **Forgetting display mode**: At least one of "Show attribute name" or "Show attribute value" must be enabled
- **Missing reload setting**: When in-place editing is enabled and other widgets depend on the attribute, enable "Reload grouped widget after attribute change"
- **Script binding confusion**: In visibility scripts, use `targetEntity` for the data source and `embeddingPage` for the widget's location

## Related Patterns

- **Master-Detail**: Use `cf.platform.connectedSingleAttribute` when the attribute source should change based on table selection
- **Grouped Attributes**: Embed multiple Single Attribute widgets within an Attributes Group for complex form layouts
- **Hierarchical Display**: Use the "Use parent page" option to show inherited attributes from parent entities
