---
schema_version: "1"
id: 60bfa56d2d8d691021a2f1ae8d8e88c9b128c5fe6f71bcc5955ba42005e45f25
title: Interfaces
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/oo/oo-interfaces.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/oo-interfaces.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 7aaa268c03b97d695bf672c6e20fbdf654ea8ba2349cb6a22d9a745203f5c270
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Interfaces

Interfaces define a component’s shape by defining attributes, events, or methods that any implementing component contains. To use an interface, a component must implement it. An interface can’t be used directly in markup.

An interface starts with the `<aura:interface>` tag, and can contain only these tags:

**`<aura:attribute>`**

This tag defines an attribute. An interface can have zero or more attributes.

**note:** To set the value of an attribute inherited from an interface, redefine the attribute in the sub component using `<aura:attribute>` and set the value in its default attribute. When you extend a component, you can use `<aura:set>` in a sub component to set the value of any attribute that’s inherited from the super component. However, this usage of `<aura:set>` doesn’t work for attributes inherited from an interface.

**`<aura:registerEvent>`**

This tag registers an event that can be fired by a component that implements the interface. There’s no logic in the interface for firing the event. A component that implements the interface contains the code to fire the event.

**`<aura:method>`**

This tag defines a method as part of the API of a component that implements the interface. There’s no logic for the method in the interface. A component that implements the interface contains the method logic.

You can’t use markup, renderers, controllers, or anything else in an interface.

## Implement an Interface

To implement an interface, set the `implements` system attribute in the `<aura:component>` tag to the name of the interface that you are implementing. For example:

```nolang
<aura:component implements="mynamespace:myinterface" >
```

A component can implement an interface and extend another component.

```nolang
<aura:component extends="ns1:cmp1" implements="ns2:intf1" >
```

An interface can extend multiple interfaces using a comma-separated list.

```nolang
<aura:interface extends="ns:intf1,ns:int2" >
```

Since there are fewer restrictions on the content of abstract components, they are more common than interfaces. A component can implement multiple interfaces but can only extend one abstract component, so interfaces can be more useful for some design patterns.

## Example

Here’s an example of an interface.

```nolang
<aura:interface>
    <aura:attribute name="value" type="String"/>

    <aura:registerEvent name="onItemSelected" type="ui:response"
      description="The event fired when the user selects an item" />

    <aura:method name="methodFromInterface">
        <aura:attribute name="stringAttribute" type="String" default="default string"/>
    </aura:method>
</aura:interface>
```

-   **[Marker Interfaces](https://developer.salesforce.com/docs/platform/aura-platform/guide/oo-interfaces-abstractcmp.md)**  


    A marker interface is an empty interface with no attributes, events, or methods. A marker interface is used to enable specific usage for a component in an app.


**See Also**  


-   [Setting Attributes Inherited from an Interface](https://developer.salesforce.com/docs/platform/aura-platform/ref/ref-tag-set-attr-intf.md)
-   [Abstract Components](https://developer.salesforce.com/docs/platform/aura-platform/guide/oo-abstract-cmp.md)

