{"id":4461,"date":"2020-04-22T11:14:08","date_gmt":"2020-04-22T18:14:08","guid":{"rendered":"https:\/\/officedevblogs.wpengine.com\/?p=4461"},"modified":"2020-04-22T11:14:08","modified_gmt":"2020-04-22T18:14:08","slug":"a-lap-around-microsoft-graph-toolkit-day-4-customizing-components","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/a-lap-around-microsoft-graph-toolkit-day-4-customizing-components\/","title":{"rendered":"A Lap around Microsoft Graph Toolkit Day 4 \u2013 Customizing Components"},"content":{"rendered":"<p><strong>Updates (December 2020):<\/strong><\/p>\n<p>As of December 11th, 2020, the Microsoft Graph Toolkit team released version 2.0. You can now customize your components and apply dark theme by adding <strong>class=&#8221;mgt-dark&#8221;<\/strong> to your HTML. You can read more about this functionality <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/toolkit\/customize-components\/style\">here<\/a>.<\/p>\n<p><strong>Author: <\/strong>Hugo Bernier, Microsoft Office Development MVP<\/p>\n<p><span data-contrast=\"auto\">Welcome to Day 4 of the <a href=\"http:\/\/aka.ms\/mgtlap\">Microsoft Graph Toolkit blog series<\/a>!<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">As\u00a0<\/span><span data-contrast=\"auto\">you have<\/span><span data-contrast=\"auto\">\u00a0seen in our previous blog\u00a0<\/span><span data-contrast=\"auto\">posts,<\/span><span data-contrast=\"auto\">\u00a0Microsoft Graph Toolkit is designed to make it easy to access and work with Microsoft Graph with a collection of framework-agnostic reusable web components.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Not only are they easy to use, but they\u2019re also designed to look and feel as if they\u2019re out-of-the-box Microsoft\u00a0<\/span><span data-contrast=\"auto\">365<\/span><span data-contrast=\"auto\">\u00a0components.<\/span><span data-contrast=\"auto\">\u00a0Your users will feel comfortable\u00a0<\/span><span data-contrast=\"auto\">with\u00a0<\/span><span data-contrast=\"auto\">the\u00a0<\/span><span data-contrast=\"auto\">UI<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-contrast=\"auto\">components they already know and love.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">For example, these one of the images below is taken from SharePoint, while the other is using a custom\u00a0<\/span><span data-contrast=\"auto\">web\u00a0<\/span><span data-contrast=\"auto\">part\u00a0<\/span><span data-contrast=\"auto\">using the Microsoft Graph Toolkit <span class=\"lang: decode:true crayon-inline \">&lt;mgt-person \/&gt;<\/span>\u00a0 component. Can you tell them apart? <\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\" data-wac-het=\"1\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4463\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2.png\" alt=\"Alt-text: A HTML element that shows Megan\u2019s profile picture, name, and email address.\" width=\"311\" height=\"61\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2.png 311w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2-300x59.png 300w\" sizes=\"(max-width: 311px) 100vw, 311px\" \/><\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4463\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2.png\" alt=\"Alt-text: A HTML element that shows Megan\u2019s profile picture, name, and email address.\" width=\"311\" height=\"61\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2.png 311w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-2-300x59.png 300w\" sizes=\"(max-width: 311px) 100vw, 311px\" \/><\/p>\n<p>But what if you need to do something that doesn\u2019t look like \u201cout-of-the-box\u201d? What if you need your custom application to stand out?\u00a0Maybe you\u2019re integrating this experience into an existing application with your own established visual style?<\/p>\n<p>You\u2019re in for a treat then: the Microsoft Graph Toolkit components are easy to customize!<\/p>\n<p>In today\u2019s post, we\u2019ll show you how to customize the look and feel of the Microsoft Graph Toolkit components.<\/p>\n<h3>Using the Microsoft Graph Toolkit Playground<\/h3>\n<p>The <a href=\"https:\/\/mgt.dev\/\">Microsoft Graph Toolkit Playground<\/a> is a great place to follow along with this post and start working with component customization. To use the playground, select a component from the list in the left navigation, then edit the HTML, JS, and\/or CSS panes on the right. As you make changes, you should see a preview of the results.<\/p>\n<h3>Using Properties and Attributes<\/h3>\n<p>Most Microsoft Graph Toolkit components provide attributes and properties that you can use to change how the component will render.<\/p>\n<p>For example, you can use the <span class=\"lang: decode:true crayon-inline \">&lt;mgt-people\/&gt;<\/span>\u00a0 component default settings by simply using the HTML element as-is:<\/p>\n<p><span class=\"lang: decode:true crayon-inline \">&lt;mgt-people&gt;&lt;\/mgt-people&gt;<\/span>\u2026which will render the profile photos or initials of the first 3 people it finds, followed by a count indicating how many more people aren\u2019t shown in the list:<\/p>\n<p><img decoding=\"async\" class=\"alignleft wp-image-4465 size-medium\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-4-300x90.png\" alt=\"mgt-people component of 10 people. 3 profile photos shown and 7 hidden.\" width=\"300\" height=\"90\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-4-300x90.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-4.png 432w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/><\/p>\n<p>But if you can override the default settings. For example, if we wanted to show a maximum of 10 people, we\u2019d use the following HTML:<\/p>\n<pre class=\"lang: decode:true\">&lt;mgt-people show-max=\"10\"&gt;&lt;\/mgt-people&gt;<\/pre>\n<p>\u2026which will render the following results:<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-large wp-image-4466\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-5-1024x127.png\" alt=\"mgt-people component of 10 people. All the profile pictures are shown.\" width=\"1024\" height=\"127\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-5-1024x127.png 1024w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-5-300x37.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-5-768x96.png 768w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-5.png 1149w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>The only thing I changed between the first and the second sample is that I set the <strong>show-max<\/strong> attribute to <strong>10<\/strong>.<\/p>\n<p>Luckily, you don\u2019t have to guess which attributes are at your disposal, the <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/toolkit\/get-started\">Microsoft Graph Toolkit documentation<\/a> tells you which attributes are at your disposal with every control.<\/p>\n<p>For example, the <span class=\"lang: decode:true crayon-inline \">&lt;mgt-person\u00a0\/&gt;<\/span>\u00a0 component\u2019s default setting is to show only the person\u2019s photo or initials:<\/p>\n<pre class=\"lang: decode:true\">&lt;mgt-person\u00a0person-query=\"me\"&gt;&lt;\/mgt-person&gt;<\/pre>\n<p>Which produces this:<\/p>\n<p><img decoding=\"async\" class=\"alignleft wp-image-4467\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-6.png\" alt=\"mgt-person component that shows Megan\u2019s profile picture. Megan is signed in as \u201dme\u201d.\" width=\"90\" height=\"84\" \/><\/p>\n<p>But if you look at the <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/toolkit\/components\/person#properties\">attributes and properties<\/a> of the person component, you\u2019ll see that we can specify <strong>view=&#8221;twoLines&#8221;<\/strong> to change the default settings. So, this:<\/p>\n<pre class=\"lang: decode:true\">&lt;mgt-person person-query=\"me\" view=\"twoLines\"&gt;&lt;\/mgt-person&gt;<\/pre>\n<p>\u2026will produce an image with the person\u2019s name and email address:<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4468\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-7.png\" alt=\"mgt-person component that shows Megan\u2019s profile picture, name, and email address.\" width=\"301\" height=\"65\" \/><\/p>\n<p>You can also dynamically change these settings using code. For example, the following HTML and JavaScript will produce the same results as above:<\/p>\n<p><strong>HTML:<\/strong><\/p>\n<pre class=\"lang: decode:true\">&lt;mgt-person person-query=\"me\"&gt;&lt;\/mgt-person&gt;\n<\/pre>\n<p><strong>JavaScript:<\/strong><\/p>\n<pre class=\"lang: decode:true\">let person = document.querySelector('mgt-person');\nperson.view = \"twoLines\";<\/pre>\n<p>You may have noticed that when I changed the settings using HTML only, I used the HTML <em>attribute<\/em>\u00a0<strong>view=&#8221;twoLines&#8221;<\/strong>, whereas in JavaScript, I used the <b>view<\/b>\u00a0<em>property. <\/em>You can control most components\u2019 settings by specifying the attributes in HTML, or the properties in JavaScript or both, depending on what you\u2019re trying to do.<\/p>\n<p>Again, each component\u2019s <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/toolkit\/components\/people#properties\">documentation page<\/a>\u00a0will give you the list of attributes and their matching properties, so you don\u2019t have to guess.<\/p>\n<p>Some components, like the <span class=\"lang: decode:true crayon-inline \">&lt;mgt-tasks \/&gt;<\/span>\u00a0 also expose more properties that don\u2019t have matching HTML attributes \u2013 partly because it wouldn\u2019t make sense to do so using HTML attributes.<\/p>\n<p>For example, using the <span class=\"lang: decode:true crayon-inline \">&lt;mgt-tasks \/&gt;<\/span>\u00a0 component, you can filter which tasks you wish to show:<\/p>\n<pre class=\"lang: decode:true\">let taskView = document.querySelector('mgt-tasks');\ntaskView.taskFilter = task =&gt;\n  task.appliedCategories.category1 === true\n  || task.appliedCategories.category2 === true\n  || task.appliedCategories.category3 === true;<\/pre>\n<p>Which will show you any task that belongs to category 1, 2, or 3 (See Try-It-Out sample <a href=\"https:\/\/github.com\/microsoftgraph\/mgtLap-TryItOut\/blob\/master\/04%20-%20Customize%20Components\/sample-tasks.html\">here<\/a>), while the following code will show you only tasks that belong to categories 1, 2, <strong>and<\/strong> 3:<\/p>\n<pre class=\"lang: decode:true\">let taskView = document.querySelector('mgt-tasks');\ntaskView.taskFilter = task =&gt;\n  task.appliedCategories.category1 === true\n  &amp;&amp; task.appliedCategories.category2 === true\n  &amp;&amp; task.appliedCategories.category3 === true;<\/pre>\n<p>And if you wanted to filter any tasks where the title contains the word \u201cLaunch\u201d, you\u2019d use the following:<\/p>\n<pre class=\"lang: decode:true\">let taskView = document.querySelector('mgt-tasks'); \ntaskView.taskFilter = task =&gt; task.title.indexOf('Launch') &gt; -1;<\/pre>\n<p>Doing the same thing with HTML attributes would be exceedingly difficult to do. Trust me, I\u2019ve tried.<\/p>\n<h3>Using Custom CSS Properties<\/h3>\n<p>So far, we\u2019ve used the attributes and properties to change the default settings of components. But what if you really want to change how the Microsoft Graph Toolkit components look, you can also use custom CSS properties. Most component expose custom CSS properties that you can override using plain old CSS to completely customize their looks. For example, you can use the &lt;mgt-person\u00a0\/&gt; component to show a standard profile card when you mouse over the name using the following HTML:<\/p>\n<pre class=\"lang: decode:true\">&lt;mgt-person\n  person-query=\"me\"\n  view=\"twoLines\"\n  person-card=\"hover\"&gt;&lt;\/mgt-person&gt;<\/pre>\n<p>Which produces the following:<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4470\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-9.png\" alt=\"mgt-person component with hover action and mgt-person-card flyout.\" width=\"385\" height=\"228\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-9.png 385w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-9-300x178.png 300w\" sizes=\"(max-width: 385px) 100vw, 385px\" \/><\/p>\n<p>But if you add the following CSS to your page:<\/p>\n<pre class=\"lang: decode:true\">mgt-person {\n  --person-card-display-name-font-size: 40px;\n  --person-card-display-name-color: #ffffff;\n  --person-card-title-font-size: 20px;\n  --person-card-title-color: #ffffff;\n  --person-card-subtitle-font-size: 10px;\n  --person-card-subtitle-color: #ffffff;\n  --person-card-details-title-font-size: 10px;\n  --person-card-details-title-color: #b3bf0a;\n  --person-card-details-item-font-size: 20px;\n  --person-card-details-item-color: #3abf0a;\n  --person-card-background-color: #000000;\n}<\/pre>\n<p>The same component will render the following:<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4471\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-10.png\" alt=\"mgt-person component with hover action and mgt-person-card flyout. Flyout has customized styles with black background color and white font color.\" width=\"375\" height=\"281\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-10.png 375w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-10-300x225.png 300w\" sizes=\"(max-width: 375px) 100vw, 375px\" \/><\/p>\n<p>These customizable styles are called <em>CSS custom properties <\/em>because properties like &#8211;person-card-display-name-font-size don\u2019t exist in standard CSS \u2013 they\u2019re custom to the Microsoft Graph Toolkit component. (See this sample in Try-It-Out repo <a href=\"https:\/\/github.com\/microsoftgraph\/mgtLap-TryItOut\/blob\/master\/04%20-%20Customize%20Components\/sample2.html\">here<\/a>.)<\/p>\n<p>You can find the list of CSS custom properties on each component\u2019s respective <a href=\"https:\/\/docs.microsoft.com\/en-us\/graph\/toolkit\/components\/person-card#css-custom-properties\">documentation<\/a>.<\/p>\n<h3>Using specific CSS<\/h3>\n<p>If you have multiple instances of a Microsoft Graph Toolkit component on a page and want to apply CSS custom properties on only one of them, you should use CSS selectors to control which instance will be modified.<\/p>\n<p>For example, let\u2019s pretend we have a bunch of person components on a page, as follows:<\/p>\n<pre class=\"lang: decode:true\">&lt;div class=\"team-list\"&gt;\n  &lt;mgt-person class=\"first\" person-query=\"MeganB@M365x214355.onmicrosoft.com\" view=\"twoLines\"&gt;&lt;\/mgt-person&gt;\n  &lt;mgt-person class=\"second\" person-query=\"IsaiahL@M365x214355.onmicrosoft.com\" view=\"twoLines\"&gt;&lt;\/mgt-person&gt;\n  &lt;mgt-person class=\"third\" person-query=\"LynneR@M365x214355.onmicrosoft.com\" view=\"twoLines\"&gt;&lt;\/mgt-person&gt;\n  &lt;mgt-person class=\"fourth\" person-query=\"bobk@tailspintoys.com\" view=\"twoLines\"l&gt;&lt;\/mgt-person&gt;\n  &lt;mgt-person class=\"fifth\" person-query=\"alex@fineartschool.net\" view=\"twoLines\"&gt;&lt;\/mgt-person&gt;\n&lt;\/div&gt;<\/pre>\n<p>If you define a CSS custom property as follows, you\u2019ll affect every persona control on the page:<\/p>\n<pre class=\"lang: decode:true\">mgt-person {\n  --color: red;\n  --avatar-size: 72px;\n  --font-size: 24px;\n}\n<\/pre>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4472\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-11.png\" alt=\"Five mgt-person components with customized CSS. Bigger avatar size, red font color, and smaller font size for email addresses.\" width=\"953\" height=\"160\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-11.png 953w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-11-300x50.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-11-768x129.png 768w\" sizes=\"(max-width: 953px) 100vw, 953px\" \/><\/p>\n<p>But if you use a CSS selector that is more specific, you can control which persona components are affected. For example, you could control individual styles by applying a custom CSS class name on each component and then applying the CSS custom properties on each component individually:<\/p>\n<pre class=\"lang: decode:true\">mgt-person.first {\n  --color: red;\n\u00a0\u00a0--avatar-size: 72px;\n\u00a0\u00a0--font-size: 24px;\n}\n\nmgt-person.second {\n\u00a0\u00a0--color: green;\n\u00a0\u00a0--avatar-size: 72px;\n\u00a0\u00a0--font-size: 24px;\n}\n\nmgt-person.third {\n\u00a0\u00a0--color: orange;\n\u00a0\u00a0--avatar-size: 72px;\n\u00a0\u00a0--font-size: 24px;\n}\n\nmgt-person.fourth {\n\u00a0\u00a0--color: blue;\n\u00a0\u00a0--avatar-size: 72px;\n\u00a0\u00a0--font-size: 24px;\n}\n\nmgt-person.fifth {\n\u00a0\u00a0--color: purple;\n\u00a0\u00a0--avatar-size: 72px;\n\u00a0\u00a0--font-size: 24px;\n}<\/pre>\n<p>Which renders each component with a different style: (See this sample in Try-It-Out repo <a href=\"https:\/\/github.com\/microsoftgraph\/mgtLap-TryItOut\/blob\/master\/04%20-%20Customize%20Components\/sample3.html\">here<\/a>.)<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4473\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-12.png\" alt=\"Five mgt-person components with customized CSS. Each person\u2019s name is shown in different colors.\" width=\"951\" height=\"165\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-12.png 951w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-12-300x52.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-12-768x133.png 768w\" sizes=\"(max-width: 951px) 100vw, 951px\" \/><\/p>\n<h3>Putting it all together<\/h3>\n<p>You can combine all the techniques we discussed in today\u2019s post with along with regular HTML and CSS techniques to completely customize the look and feel of your components.<\/p>\n<p>For example, if you wanted to display the same list of team members so that it looks like a bunch of polaroids on a page, you could use the following custom CSS (inspired from <a href=\"https:\/\/zurb.com\/playground\/css3-polaroids\">this page<\/a>) :<\/p>\n<pre class=\"lang: decode:true\">.team-list mgt-person {\n  --avatar-size: 72px;\n  --font-size: 24px;\n  width:300px;\n  padding: 12px;\n  transform: rotate(-2deg);\n  transition: -webkit-transform .15s linear;\n  box-shadow: 0 3px 6px rgba(0,0,0,.25);\n  background-color:white;\n  margin: 8px;\n}\n\n.team-list mgt-person:hover {\n  -webkit-transform: scale(1.25);\n  -moz-transform: scale(1.25);\n  position: relative;\n  z-index: 5;\n  box-shadow: 0 3px 6px rgba(0,0,0,.5);\n}\n\nmgt-person.second, mgt-person.fourth {\n  -webkit-transform: rotate(2deg);\n  -moz-transform: rotate(2deg);\n}\n\n\/* Don't rotate every third image, but offset its position *\/\nmgt-person.third {\n  -webkit-transform: none;\n  -moz-transform: none;\n  position: relative;\n  top: -5px;\n}\n\n\/* Rotate every fifth image by 5 degrees and offset it *\/\nmgt-person.fifth {\n  -webkit-transform: rotate(5deg);\n  -moz-transform: rotate(5deg);\n  position: relative;\n  right: 5px;\n}\n<\/pre>\n<p>Which produces the following results:<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4474\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-13.png\" alt=\"Five mgt-person components with customized CSS creating a polaroids effect.\" width=\"715\" height=\"356\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-13.png 715w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/Image-13-300x149.png 300w\" sizes=\"(max-width: 715px) 100vw, 715px\" \/><\/p>\n<p>With a cool hover effect: (See this sample in Try-It-Out repo <a href=\"https:\/\/github.com\/microsoftgraph\/mgtLap-TryItOut\/blob\/master\/04%20-%20Customize%20Components\/sample4.html\">here<\/a>.)<\/p>\n<p><img decoding=\"async\" class=\"alignleft size-full wp-image-4475\" src=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/image-15.png\" alt=\"Five mgt-person components with customized CSS creating a polaroids effect. When hover over each mgt-person component, the element stands out.\" width=\"780\" height=\"357\" srcset=\"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/image-15.png 780w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/image-15-300x137.png 300w, https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-content\/uploads\/sites\/73\/2020\/04\/image-15-768x352.png 768w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/p>\n<h3>Conclusion<\/h3>\n<p>In this post, we\u2019ve shown you how you can use attributes and properties to change the default settings of Microsoft Graph Toolkit components.<\/p>\n<p>You should use attributes within your HTML, and properties within your code.<\/p>\n<p>To completely change the look of a component, you can use the CSS custom properties within your CSS file (or &lt;styles\/&gt; element).<\/p>\n<p>But you can customize the components even more! In our next blog post, we\u2019ll show you how you can use templating to override the content inside of a component.<\/p>\n<p>Stay tuned for the <a href=\"https:\/\/developer.microsoft.com\/en-us\/graph\/blogs\/a-lap-around-microsoft-graph-toolkit-day-5-customizing-components-using-templates\/\">next blog<\/a> in our <a href=\"https:\/\/aka.ms\/mgtlap\">series<\/a>! We will show you how to utilize templates to further customize toolkit component.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In day 4 of A Lap around Microsoft Graph Toolkit, we will show you how to use attributes, properties, and CSS properties to customize the functionality and appearance of components. A cool demo of how to create a display of your team members that it looks like a bunch of polaroids!<\/p>\n","protected":false},"author":69077,"featured_media":25159,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[3],"tags":[34],"class_list":["post-4461","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-microsoft-graph","tag-microsoft-graph-toolkit"],"acf":[],"blog_post_summary":"<p>In day 4 of A Lap around Microsoft Graph Toolkit, we will show you how to use attributes, properties, and CSS properties to customize the functionality and appearance of components. A cool demo of how to create a display of your team members that it looks like a bunch of polaroids!<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/4461","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/users\/69077"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/comments?post=4461"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/posts\/4461\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media\/25159"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/media?parent=4461"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/categories?post=4461"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/microsoft365dev\/wp-json\/wp\/v2\/tags?post=4461"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}