I work with trailhead unit Create a Child Component and Interact with It in Build a Bear-Tracking App with Lightning Web Components module.

The bearTile component triggers bearview event in this way:

handleOpenRecordClick() {
    const selectEvent = new CustomEvent('bearview', {
        bubbles: true

in the class code there is also: @api bear;

And the top parent component gets the event having access to the bear property in the event object:

handleBearView(event) {
    // Navigate to bear record page
        type: 'standard__recordPage',
        attributes: {
            recordId: event.target.bear.Id,
            objectApiName: 'Bear__c',
            actionName: 'view',

I do not understand how it is possible while not declaring a new detail property of the CustomEvent instance.

Could any of you guide me on with that subject?

1 Answer 1


event.target is the element that dispatched the event. Therefore, anything that's an @api on the target can be accessed by any other component that can handle the event (by default, just the parent template). You don't need to specify a detail in this case. Note that @track and undecorated properties will not be accessible.

  • It makes sense. Thank you. Apr 21, 2019 at 19:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.