# Computed Properties

Computed properties let you declare a function as a property that can be accessed from within your template as well as from within your component.

They are used to take normal properties (e.g., data that is returned by your integration in `block.data.details`) and manipulate or transform them.

As an example, the following is a computed property that takes a `firstName` and `lastName` property and returns a `fullName`.&#x20;

{% code title="component.js" %}

```javascript
'use strict';

polarity.export = PolarityComponent.extend({
    fullName: Ember.computed('block.data.details.firstName', 'block.data.details.lastName',
        function(){
            return `${this.get('block.data.details.firstName')} 
                ${this.get('block.data.details.lastName')}`;
    })    
});
```

{% endcode %}

The first argument or arguments are strings which define the properties that the computed property is dependent on.  Anytime any of the properties change in value, the computed property is recomputed.  In the example above, the computed property `fullName` is dependent on the `block.data.details.firstName` and `block.data.details.lastName` properties.&#x20;

Once you have created a computed property you can access that value directly within your templates using the curly brace syntax. &#x20;

{% code title="template.hbs" %}

```markup
<div>
    fullName: {{fullName}}
</div>
```

{% endcode %}

You can also access the computed property within the component and create computed properties based on computed properties. Anytime the `firstName` or `lastName` values change the `fullName` computed property is updated. When the `fullName` computed property gets updated the `fullNameLower` property will also get updated.

```javascript
'use strict';

polarity.export = PolarityComponent.extend({
    fullName: Ember.computed('block.data.details.firstName', 'block.data.details.lastName',
        function(){
            return `${this.get('block.data.details.firstName')} 
                ${this.get('block.data.details.lastName')}`;
    }),    
    fullNameLower: Ember.computed('fullName', function(){
        return this.get('fullName').toLowerCase();    
    })        
});
```

{% hint style="info" %}
For more information on computed properties please see <https://guides.emberjs.com/v3.4.0/object-model/computed-properties/>
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.polarity.io/integrations/build-an-integration/customizing-the-overlay-window/component-file/computed-properties.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
