> For the complete documentation index, see [llms.txt](https://docs.gridmate.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.gridmate.io/package-reference/components-library/gm-record-layout-lwc.md).

# GM - Record Layout (LWC)

(gmpkg:RecordLayoutLWCComponent)

## **Documentation**

**GM - Record Layout (LWC)** component is used to display a related object using a layout configuration same as [GM - Record Layout](/package-reference/components-library/gm-record-layout.md#documentation). It bypasses the limitation of Salesforce UI API. This component can be used to manipulate any Salesforce object especially **Event** and **Task**.

**Use case:** Display the event details when expanding a record from open activities related list. See [Record Layout (LWC) tutorial](/product-tour/record-layout-lwc.md).

## **Specification**

<table data-full-width="true"><thead><tr><th width="191.67917410949835">Property</th><th width="154.55150547835012">Type</th><th>Description</th></tr></thead><tbody><tr><td>recordId</td><td>String</td><td>recordId to use. Use it only for community.</td></tr><tr><td>Object Name *</td><td>String</td><td>The name of the related object to display.</td></tr><tr><td>Record Id Field *</td><td>String</td><td>The name of the lookup field to display. If the record layout displays the current object, set this field to <strong>recordId</strong>.</td></tr><tr><td>Record Layout *</td><td>String</td><td>JSON record layout describing the sections and their visibility. See <a href="/package-reference/components-library/gm-record-layout.md#record-layout-schema">Record Layout Schema</a></td></tr><tr><td>Show Border</td><td>Boolean</td><td>Check this option if you wish to show the record card border.</td></tr></tbody></table>

Compared to [**GM - Record Layout**](/package-reference/components-library/gm-record-layout.md#specification), it provides more capabilities in terms of styling. Section header can be hidden and each field can be styled by setting the variant, the border, the label styling and the value styling. The styling capabilities are useful on a community website for instance. Below is a configuration to showcase the styling:

```json
{
    "density": "comfy",
    "sections": [
        {
            "name": "contactInformation",
            "label": "Contact Information",
            "variant": "header-hidden",
            "active": "always",
            "cols": 1,
            "rows": [
                [
                    {
                        "apiName": "Name",
                        "variant": "label-hidden",
                        "style": {
                            "label": "font-size:large;color:red",
                            "value": "font-size:large;text-align:center;color:green",
                            "border": "none"
                        }
                    }
                ],
                [
                    {
                        "apiName": "gmpkg__Image_Test__c",
                        "variant": "label-hidden",
                        "style": {
                            "value": "text-align:center",
                            "border": "none"
                        }
                    }
                ]
            ]
        }
    ]
}
```

## **API Reference**

{% tabs fullWidth="true" %}
{% tab title="RecordLayoutLWCComponent.design" %}

```xml
<design:component label="GM - Record Layout (LWC)">    
    <design:attribute name="recordId" label="recordId" 
                      description="recordId to use. Use it only for community"/>        
    <design:attribute name="targetObjName" label="Object Name" 
                      description="Object Name to load"/>    
    <design:attribute name="recordIdField" label="Record Id Field" 
                      description="Record Id Field to load" />
    <design:attribute name="recordLayout" label="Record Layout" 
                      description="JSON Record Layout"/>    
    <design:attribute name="showBorder" label="Show Border" 
                      description="Show record card border"/>    
</design:component>
```

{% endtab %}
{% endtabs %}
