web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Getting the component ...
Power Apps
Unanswered

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.

I have the same question (0)
  • Verified answer
    Diana Birkelbach Profile Picture
    3,072 Most Valuable Professional on at

    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!

  • MCrawley2 Profile Picture
    41 on at

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

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard