In this blog, we will learn the child to parent communication in LWC. We are going to create a progress bar component to understand how a child event can be bubbled up to the parent. We will use the custom event of js to achieve this. To create a custom event we will use CustomEvent() constructor syntax as :

event = new CustomEvent(typeArg, customEventInit);

Can check
To fire the trigger use the dispatchEvent method of EventTarget.
Can check

Also Read: How To Use Properties In Lightning Web Component

Now let’s get your hand dirty with code first and then will understand the flow of code.


    <lightning-tile label='Child Component'>
        <lightning-input name='barMeter' label='Enter Value for Progress Bar' onchange={progress}></lightning-input>


import { LightningElement } from 'lwc';

export default class InputProgressBar extends LightningElement {
        const custEvent = new CustomEvent(
            'callpasstoparent', {


import { LightningElement, track } from 'lwc';

export default class ParentBarCmp extends LightningElement {
    @track barVal = 10;
        this.barVal = event.detail;



    <lightning-tile label='Parent Bar Component'>
        <lightning-progress-bar value={barVal} size="large"></lightning-progress-bar>
    <c-input-progress-bar oncallpasstoparent={passToParent}></c-input-progress-bar>


<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="">
hire salesforce developers

1. First, we have created a child component to receive user input and onchange handler is used to capture the input value.
2. We have created a parent component that is showing a progress bar based on input that the user enters in the child component.
3. So we need to pass this input value from child to parent component and to achieve this we used the event bubbling concept.
4. We have created a custom event and passed that input value and fired that event using dispatchEvent. This way callpasstoparent event fired


5. When this event fired it calls passToParent. In this event, we received the value and set it as progress bar value

<c-input-progress-bar oncallpasstoparent={passToParent}></c-input-progress-bar>

This way we are passing value from child to parent component. Using the below syntax can send multiple data as well.

detail : {
 param1: value1,
param2 : value2

I hope this blog helped you. Keep learning and if you require salesforce development services then get in touch with our salesforce consulting team.

Learn more: How To Create Web To Lead / Web To Case Forms and How To Handle Form Values On Event In LWC

Avatar photo

With a decade of experience in eCommerce technologies and CRM solutions, Virendra has been assisting businesses across the globe to harness the capabilities of information technology by developing, maintaining, and improving clients’ IT infrastructure and applications. A leader in his own rights his teammates see him as an avid researcher and a tech evangelist. To know how the team Virendra can assist your business to adopt modern technologies to simplify business processes and enhance productivity. Let’s Talk.