---
schema_version: "1"
id: 2f73bc9803ea3ab21bda4728c3c6cf510c2649ca6c39e5db069b04646725ac37
title: Component Attributes
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/components/components-attributes.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/components-attributes.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: dfc13833a261a9678c4c0e48e199250361fdd51675153ce5ecd0d4b88154061e
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Component Attributes

Component attributes are like member variables on a class in Apex. They are typed fields that are set on a specific instance of a component, and can be referenced from within the component's markup using an expression syntax. Attributes enable you to make components more dynamic.

Use the `<aura:attribute>` tag to add an attribute to the component or app. Let’s look at the following sample, `helloAttributes.app`:

<!-- otherprops: set_clipboard -->

```nolang
<aura:application>
    <aura:attribute name="whom" type="String" default="world"/>
    Hello {!v.whom}!
</aura:application>


```

All attributes have a name and a type. Attributes may be marked as required by specifying `required="true"`, and may also specify a default value.

In this case we've got an attribute named `whom` of type String. If no value is specified, it defaults to "world".

Though not a strict requirement, `<aura:attribute>` tags are usually the first things listed in a component’s markup, as it provides an easy way to read the component's shape at a glance.

## Attribute Naming Rules

An attribute name must follow these naming rules:

- Must begin with a letter or an underscore
- Must contain only alphanumeric or underscore characters

## Expressions

`helloAttributes.app` contains an expression, `{!v.whom}`, which is responsible for the component's dynamic output.

`{!expression}` is the framework's expression syntax. In this case, the expression we are evaluating is `v.whom`. The name of the attribute we defined is `whom`, while `v` is the value provider for a component's attribute set, which represents the view.

**note:** Expressions are case sensitive. For example, if you have a custom field `myNamespace__Amount__c`, you must refer to it as `{!v.myObject.myNamespace__Amount__c}`.

- **[Supported aura:attribute Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-aura-attribute.md)**


    `aura:attribute` describes an attribute available on an app, interface, component, or event.

- **[Basic Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-basic.md)**

- **[Function Type](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-function.md)**


    An attribute of an `aura:method` can have a type corresponding to a JavaScript function so that you can pass a function into the method. An attribute of a component can’t have a type corresponding to a JavaScript function.

- **[Object Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-object.md)**

- **[Standard and Custom Object Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-object-salesforce.md)**

- **[Collection Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-collection.md)**

- **[Custom Apex Class Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-apex.md)**


    An Aura component attribute type can correspond to values held in an Apex class. An attribute type can be a custom Apex class, a List standard Apex class, or a Map standard Apex class. To use values held in other standard Apex classes, first create a custom Apex class, and then copy the needed values from instances of the standard class into your custom class.

- **[Framework-Specific Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-attr-types-aura.md)**

**See Also**

- [Supported aura:attribute Types](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-aura-attribute.md)
- [Using Expressions](https://developer.salesforce.com/docs/platform/aura-platform/expr/expr-overview.md)
