Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Power Apps Pro Dev & ISV
Answered

Getting the component name in code

(0) ShareShare
ReportReport
Posted on by 41

We're trying to address a bunch of accessibility issues, one in particular is proving quite difficult.

 

We need to supply for="" atributes for our components in order for screen readers to correctly read out the component details for users with accessibility needs.

 

The problem we've got is that we would have multiple of the same PCF on a screen, so we need the name="" attribute in our HTML to be unique - Ideally we'd like to grab the name as defined in the PowerApp designer, I thought there'd be a way to do this from the context object but I'm not seeing anything obvious.

Is this possible?

If not, the only workaround we can think of is to set the name attribute as a random string within the PCF itself but that's not a great idea.

Thanks.

  • MCrawley2 Profile Picture
    41 on at
    Re: Getting the component name in code

    Perfect, must have just missed that one! Thank you!

  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at
    Re: Getting the component name in code

    Hi  @MCrawley2 , 

     

    You could use context.mode.label (https://docs.microsoft.com/en-us/powerapps/developer/component-framework/reference/mode?WT.mc_id=BA-MVP-5004107#label)

     

    If that's not appropriate, you could use the PCF parameteres : context.parameter.<your>.attributes ... In the worst case, you could even create a dedicated property for it, and let the maker decide.

     

    Hope this helps!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Power Apps Pro Dev & ISV

#1
WarrenBelz Profile Picture

WarrenBelz 109 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 82 Super User 2025 Season 1

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 72

Overall leaderboard