---
schema_version: "1"
id: 1f486535a3483bf4c4233f86027fdf82c344000e03069aec93805467f428e64c
title: Setting Label Values via a Parent Attribute
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/labels/labels-parentcmp.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/labels-parentcmp.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 763dc6034fa856c6ab1bf45bc3d3e7bf7639641c6d3c573521cd19f307a75118
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Setting Label Values via a Parent Attribute

Setting label values via a parent attribute is useful if you want control over labels in child components.

Let’s say that you have a container component, which contains another component, inner.cmp. You want to set a label value in inner.cmp via an attribute on the container component. This can be done by specifying the attribute type and default value. You must set a default value in the parent attribute if you are setting a label on an inner component, as shown in the following example.

This is the container component, which contains a default value `My Label` for the `_label` attribute .

<!-- otherprops: set_clipboard -->
```nolang
<aura:component>
    <aura:attribute name="_label" 
                    type="String" 
                    default="My Label"/>
    <lightning:button label="Set Label" aura:id="button1" onclick="{!c.setLabel}"/>
    <auradocs:inner aura:id="inner" label="{!v._label}"/>
</aura:component>
```

This inner component contains a text area component and a `label` attribute that’s set by the container component.

<!-- otherprops: set_clipboard -->
```nolang
<aura:component>
    <aura:attribute name="label" type="String"/>
    <lightning:textarea aura:id="textarea"
                      name="myTextarea"
                      label="{!v.label}"/>
</aura:component>
```

This client-side controller action updates the label value.

<!-- otherprops: set_clipboard -->
```javascript
({
    setLabel:function(cmp) {
        cmp.set("v._label", 'new label');
    }
})
```

When the component is initialized, you’ll see a button and a text area with the label `My Label`. When the button in the container component is clicked, the `setLabel` action updates the label value in the inner component. This action finds the `label` attribute and sets its value to `new label`.

**See Also**  


-   [Input Component Labels](https://developer.salesforce.com/docs/platform/aura-platform/guide/labels-overview.md)
-   [Component Attributes](https://developer.salesforce.com/docs/platform/aura-platform/components/components-attributes.md)

