<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: muzamilabbas</title>
    <description>The latest articles on DEV Community by muzamilabbas (@muzamilabbas).</description>
    <link>https://dev.to/muzamilabbas</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F583352%2F50d3d682-60e9-4886-9ee7-b72fb8ef6045.png</url>
      <title>DEV Community: muzamilabbas</title>
      <link>https://dev.to/muzamilabbas</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muzamilabbas"/>
    <language>en</language>
    <item>
      <title>Style CSS properties on an element inside of a shadow tree</title>
      <dc:creator>muzamilabbas</dc:creator>
      <pubDate>Sun, 21 Feb 2021 12:47:33 +0000</pubDate>
      <link>https://dev.to/muzamilabbas/style-css-properties-on-an-element-inside-of-a-shadow-tree-f1f</link>
      <guid>https://dev.to/muzamilabbas/style-css-properties-on-an-element-inside-of-a-shadow-tree-f1f</guid>
      <description>&lt;p&gt;
After introducing Shadow DOM in IONIC most of us searching and finding a way to modify style of IONIC components. Fortunately they have exposed many css4 variables to modify the components but we can't access the html elements inside the Shadow DOM.
&lt;/p&gt;

&lt;h3&gt;How to update style using exposed css4 variables?&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--egnxtVuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--egnxtVuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;pre&gt;
ion-button{
  --border-radius: 2px;
  --background: #3A2926;
  --color: #DBE0A5;
}
&lt;/pre&gt;

&lt;h3&gt;How to update style of properties that are not exposed?&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--egnxtVuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--egnxtVuc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/lqp3y1gigyra3yzu09ob.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;
In the above screenshot we cannot modify the properties like cursor, z-index, box-sizing etc. from outside the Shadow DOM using normal CSS like following style.
&lt;/p&gt;

&lt;pre&gt;
ion-button button{
  cursor: crosshair;
  z-index: 2;
  box-sizing: content-box;
}
&lt;/pre&gt;

&lt;h5&gt;How to update above properties &lt;/h5&gt;

&lt;p&gt;
We can use Shadow Part selector to update the these properties. 
&lt;/p&gt;

&lt;pre&gt;
ion-button{
  &amp;amp;::part(native) {
    cursor: crosshair;
    z-index: 2;
    box-sizing: content-box;
  }
}
&lt;/pre&gt;

&lt;p&gt;
I hope this will help many developers. 
&lt;/p&gt;

&lt;h2&gt;Resources&lt;/h2&gt;

&lt;p&gt;&lt;a title="Ionic Framework" href="https://ionicframework.com/docs"&gt;&lt;/a&gt;&lt;a href="https://ionicframework.com/docs"&gt;https://ionicframework.com/docs&lt;/a&gt;&lt;a href="https://ionicframework.com/docs/theming/css-shadow-parts"&gt;&lt;br&gt;
&lt;/a&gt;&lt;a href="https://ionicframework.com/docs/theming/css-shadow-parts"&gt;https://ionicframework.com/docs/theming/css-shadow-parts&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>shadowdom</category>
      <category>ionic</category>
    </item>
  </channel>
</rss>
