---
schema_version: "1"
id: 97eec7a5d510ff1104587d2a70861b4c95f2e2f100947a5a2c5b53e3e54da2f9
title: Fire Component Events
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/platform/aura-platform/guides/aura/events/events-component-fire.md
canonical_url: https://developer.salesforce.com/docs/platform/aura-platform/guide/events-component-fire.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: 5bc887826a85d41a059a0339c5b8bd3e4253edbcb59771e514f14693196fc08e
products:
  - Lightning Aura Components Developer Guide
  - Platform Developer Content
---

# Fire Component Events

Fire a component event to communicate data to another component. A component event can be handled by the component that fired the event or by a component in the containment hierarchy that receives the event.

## Register an Event

A component registers that it may fire an event by using `<aura:registerEvent>` in its markup. For example:

```nolang
<aura:registerEvent name="sampleComponentEvent" type="c:compEvent"/>
```

We’ll see how the value of the `name` attribute is used for firing and handling events.

## Fire an Event

To get a reference to a component event in JavaScript, use `cmp.getEvent("evtName")` where `evtName` matches the `name` attribute in `<aura:registerEvent>`.

Use `fire()` to fire the event from an instance of a component. For example, in an action function in a client-side controller:

```javascript
var compEvent = cmp.getEvent("sampleComponentEvent");
// Optional: set some data for the event (also known as event shape)
// A parameter’s name must match the name attribute
// of one of the event’s <aura:attribute> tags
// compEvent.setParams({"myParam" : myValue });
compEvent.fire();
```

**See Also**  


-   [Fire Application Events](https://developer.salesforce.com/docs/platform/aura-platform/guide/events-application-fire.md)

