CSS Isolation in .Net 5.0 with Syncfusion controls
Hello
Do you have any doco / examples of using css isolation, i.e. placing css in MyPage.razor.css to style Syncfusion components.
Thanks
SIGN IN To post a reply.
14 Replies
1 reply marked as answer
DI
Ditchford
October 23, 2020 11:57 PM UTC
Hello
Any feedback on this.?
Thanks
DI
Ditchford
November 9, 2020 08:56 AM UTC
Anyone....Bueller?
MK
Muthukumar Kannan
Syncfusion Team
November 10, 2020 06:26 PM UTC
Hi Ditchford,
We deeply regret for the inconvenience caused.
We have validated your reported query for "CSS Isolation with Syncfusion components". Here, we would like to let you know that, our syncfusion components are multi theme supported. So that CSS Isolation is not recommended for it.
However, we are working on modifying the synfcuion components by CSS Isolation by using scoped CSS.
Currently, we are working on this with prioritization. We will share further details on November 16th,2020.
Until then we appreciate your patience.
Regards,
Muthukumar K
JO
Joe
November 19, 2020 07:48 PM UTC
Hi Muthukumar ,
Any update on this?
Thanks,
Joe
Joe
MK
Muthukumar Kannan
Syncfusion Team
November 24, 2020 05:41 PM UTC
Hi Ditchford / Joe,
Sorry for the delayed response.
We have prepared a sample to demonstrate “Styling our Syncfusion components using CSS isolation” and attached the sample below for your reference. In that, we have styling our components (e.g: Button & Calendar) by changing its background-color from scoped CSS. Please check the below details and get back to us if you need any further assistance.
Code example:
Components.razor
|
<h2>Button</h2>
<div> <SfButton>SFButton</SfButton> </div> <h2>Calendar</h2> <span> <SfCalendar TValue="DateTime"></SfCalendar> </span> |
Components.razor.css
|
::deep .e-btn {
background-color: darksalmon; } ::deep .e-calendar { background-color: lightblue; } |
output:
Note:
Our components should be added within block/inline containers and we need to add '::deep' CSS pseudo-selector to add the scoped CSS for all descendant components. Use !important in CSS style attributes for modifying all the child and nested components.
Regards,
Muthukumar K
Marked as answer
TI
Tim
November 29, 2020 09:15 AM UTC
::deep
works for me.
Thanks Muthukumar
MC
Mike Chafin
November 29, 2020 04:17 PM UTC
Take a look at
https://daveabrock.com/2020/09/10/blazor-css-isolation
https://docs.microsoft.com/en-us/aspnet/core/blazor/components/css-isolation?view=aspnetcore-5.0
MK
Muthukumar Kannan
Syncfusion Team
December 1, 2020 11:42 AM UTC
Hi Tim / Mike,
Welcome. Thanks for your valuable information.
Regards,
Muthukumar K
DI
Ditchford
December 23, 2020 07:52 AM UTC
Hello Muthukumar
Attachment: SyncfusionTroubleshoot_b4f72396.zip
Thank you for your feedback. I have been playing with css isolation with varying success. I have attached a sample. In the pivot table page in the sample I have added a PivotTable.razor.css file and added some css. The styling of the buttons works as expected, but when I try to style something more complex like the FieldList width then this does not work.
Any ideas?
Attachment: SyncfusionTroubleshoot_b4f72396.zip
SS
Saranya Sivan
Syncfusion Team
December 23, 2020 12:54 PM UTC
Hi Ditchford,
The reported problem occurs due to the field list dialog UI appended at end of the document body by default, which is not match the given selector in below CSS file.
To overcome this problem, kindly use the "Target" property to append the field list dialog as required. For your convenience, we have modified the given sample below for your reference.
Also, you can simply using below CSS style for dialogs inside the body tag to achieve this. Please find the code snippet below. Using this, it will apply to all the dialog UI inside the body tag.
|
<style>
body .e-dialog.e-popup { width: width: 200px !important; } </style> |
Note: We suggest you to use "!important" to avoid the style overriding problem.
Sample link: https://www.syncfusion.com/downloads/support/directtrac/general/7z/SyncfusionTroubleshoot-1271847866
Regards,
Saranya.
Saranya.
DI
Ditchford
December 24, 2020 12:42 AM UTC
Hey Saranya
Thanks...that works.
Regards
SS
Saranya Sivan
Syncfusion Team
December 24, 2020 05:03 AM UTC
Hi Ditchford,
Thanks for the reply.
Please let us know if you have any other queries. We are always happy to assist you.
Regards,
Saranya.
MG
Miles Gibson
February 18, 2021 03:11 AM UTC
I would like to use the FileManager control. However, it is not rendering properly, likely due to css conflicts. How do I know what CSS styles to add into a custom MyFileManager.razor.css file?
TIA,
Miles
IL
Indhumathy Loganathan
Syncfusion Team
February 18, 2021 12:15 PM UTC
Hi Miles,
We have prepared a simple FileManager sample with CSS isolation styling. We have customized the FileManager background color and the Toolbar background color and it is working fine for us.
Please refer to the below code snippets.
index.razor
|
<h2>FileManager</h2>
<div>
<SfFileManager TValue="FileManagerDirectoryContent">
<FileManagerAjaxSettings Url="https://ej2-aspcore-service.azurewebsites.net/api/FileManager/FileOperations"
</FileManagerAjaxSettings>
</SfFileManager>
</div> |
index.razor.css
|
::deep .e-filemanager {
background-color: #bacadb !important;
}
::deep .e-toolbar .e-toolbar-items {
background: #297bce !important;
} |
Please find the sample from below link.
Note: Use !important in CSS style attributes for modifying all the child and nested components.
Please let us know if you need any further assistance.
Regards,
Indhumathy L
SIGN IN To post a reply.
- 14 Replies
- 8 Participants
- Marked answer
-
DI Ditchford
- Oct 11, 2020 04:15 AM UTC
- Feb 18, 2021 12:15 PM UTC