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 / Get default CSS for fi...
Power Apps
Unanswered

Get default CSS for field in PCF

(0) ShareShare
ReportReport
Posted on by 57

Hello! 

I created a very simple PCF, a SingleLine.Text with an HTML password attribute: 

Arcadi_0-1636879695205.png

It looks nice, like a standard field, but the reality is that there is custom CSS, some of it I copied from other PCF's in Github and some other properties I had to tweak them myself. If I don't add CSS it looks like:

Arcadi_1-1636879725693.png

 

The problem with that is that when Microsoft changes the CSS, for example making the border blue on hover my PCF will retain the old design. 

 

Microsoft uses this classes: 

Arcadi_2-1636879876019.png

The problem is that those classes are dynamic, so I cannot have my input the classes "pa-x pa-bv..." because won't work in the next refresh.

 

Any ideas of how to use the default classes/CSS without hardcoding them in my PCF CSS file?

Thanks 

I have the same question (0)
  • cchannon Profile Picture
    4,702 Moderator on at

    Well, you could read the style elements from other fields on the form, but that would mean a lot of dom browsing and would be very brittle. If you try it, you're probably only going to introduce problems and break your own code when--as you say--Microsoft changes the CSS (or something more fundamental).

     

    I think you'd be much better off not trying to get an exact styling match and instead just use something that matches the overall aesthetic. I generally use Fluent UI controls for the reason; they are close enough to the styling of OOB Dataverse controls and--more importantly--Microsoft maintains them for me. So if some day Microsoft decides that a meaningful style change is appropriate to their controls, they are likely to make it in Dataverse and in the Fluent UI controls both.

  • Arcadi Profile Picture
    57 on at

    Thanks @cchannon for your answer, 

    I've tried Fluent UI before and I'll probably stick to it in the future 

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 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard