<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[FAST - Medium]]></title>
        <description><![CDATA[Interfaces built with FAST adapt to your design system and can be used with any modern UI Framework by leveraging industry standard Web Components. - Medium]]></description>
        <link>https://medium.com/fast-design?source=rss----18962b425c12---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>FAST - Medium</title>
            <link>https://medium.com/fast-design?source=rss----18962b425c12---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 21 May 2026 14:27:20 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/fast-design" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[What’s new in the Microsoft Fluent UI library for Blazor version 2.0]]></title>
            <link>https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-2-0-b3ac0eb5d02c?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/b3ac0eb5d02c</guid>
            <category><![CDATA[fluent-ui]]></category>
            <category><![CDATA[blazor]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[Vincent Baaij]]></dc:creator>
            <pubDate>Mon, 05 Dec 2022 14:28:41 GMT</pubDate>
            <atom:updated>2023-01-10T08:14:08.486Z</atom:updated>
            <content:encoded><![CDATA[<p>Well, as you kind of expect when there is a new major version number, quite a lot actually (with over 150 commits to the repository between the previous version and this one). In this post we’ll go through the changes and additions. Make sure you have some refreshments available, it’s gonna be a long ride.</p><p>A̵t̵ ̵t̵h̵e̵ ̵m̵o̵m̵e̵n̵t̵,̵ ̵t̵h̵e̵ ̵p̵a̵c̵k̵a̵g̵e̵ ̵i̵s̵ ̵a̵v̵a̵i̵l̵a̵b̵l̵e̵ ̵o̵n̵ ̵N̵u̵G̵e̵t̵ ̵a̵s̵ ̵t̵h̵e̵ ̵f̵i̵r̵s̵t̵ ̵R̵e̵l̵e̵a̵s̵e̵ ̵C̵a̵n̵d̵i̵d̵a̵t̵e̵ ̵(̵R̵C̵1̵)̵ ̵v̵e̵r̵s̵i̵o̵n̵.̵ ̵T̵h̵i̵s̵ ̵m̵e̵a̵n̵s̵ ̵w̵e̵ ̵w̵i̵l̵l̵ ̵n̵o̵t̵ ̵b̵e̵ ̵a̵d̵d̵i̵n̵g̵ ̵a̵n̵y̵ ̵n̵e̵w̵ ̵f̵u̵n̵c̵t̵i̵o̵n̵a̵l̵i̵t̵y̵ ̵b̵e̵t̵w̵e̵e̵n̵ ̵n̵o̵w̵ ̵a̵n̵d̵ ̵t̵h̵e̵ ̵r̵e̵l̵e̵a̵s̵e̵ ̵o̵f̵ ̵t̵h̵e̵ ̵f̵i̵n̵a̵l̵ ̵v̵e̵r̵s̵i̵o̵n̵.̵ ̵W̵e̵’̵l̵l̵ ̵f̵o̵c̵u̵s̵ ̵o̵n̵ ̵f̵i̵n̵d̵i̵n̵g̵ ̵a̵n̵d̵ ̵f̵i̵x̵i̵n̵g̵ ̵b̵u̵g̵s̵.̵ ̵I̵t̵ ̵w̵o̵u̵l̵d̵ ̵b̵e̵ ̵g̵r̵e̵a̵t̵ ̵i̵f̵ ̵y̵o̵u̵ ̵c̵a̵n̵ ̵h̵e̵l̵p̵ ̵u̵s̵ ̵w̵i̵t̵h̵ ̵t̵h̵i̵s̵,̵ ̵t̵a̵k̵e̵ ̵t̵h̵e̵ ̵p̵a̵c̵k̵a̵g̵e̵ ̵f̵o̵r̵ ̵a̵ ̵s̵p̵i̵n̵ ̵i̵n̵ ̵y̵o̵u̵r̵ ̵o̵w̵n̵ ̵(̵t̵e̵s̵t̵)̵ ̵p̵r̵o̵j̵e̵c̵t̵s̵ ̵a̵n̵d̵ ̵r̵e̵p̵o̵r̵t̵ ̵a̵n̵y̵ ̵i̵s̵s̵u̵e̵s̵ ̵i̵n̵ ̵t̵h̵e̵ ̵G̵i̵t̵h̵u̵b̵ ̵r̵e̵p̵o̵s̵i̵t̵o̵r̵y̵.̵ ̵D̵e̵p̵e̵n̵d̵i̵n̵g̵ ̵o̵n̵ ̵w̵h̵a̵t̵ ̵i̵s̵ ̵f̵o̵u̵n̵d̵,̵ ̵w̵e̵ ̵m̵i̵g̵h̵t̵ ̵r̵e̵l̵e̵a̵s̵e̵ ̵a̵n̵o̵t̵h̵e̵r̵ ̵R̵C̵ ̵b̵e̵f̵o̵r̵e̵ ̵t̵h̵e̵ ̵f̵i̵n̵a̵l̵ ̵r̵e̵l̵e̵a̵s̵e̵.̵<br><strong><em>Update: the final version of the 2.0 package is available on </em></strong><a href="https://www.nuget.org/packages/Microsoft.Fast.Components.FluentUI"><strong><em>NuGet </em></strong></a><strong><em>now!</em></strong></p><p>We’ll present the changes in a condensed form first. Starting with what’s new for the library and then what’s new to the documentation and example site(s). After that, we’ll dive into the details. If you’re already using the library in your Blazor WASM or Server applications and you want to upgrade to this version, you’re going to need that detailed information. As with most major releases, this one comes with breaking changes as well…</p><h3>Library changes</h3><ul><li>Re-implemented the DataGrid (leveraging the ASP.NET Team’s QuickGrid)</li><li>Re-implemented the Combobox, Listbox, and Select components</li><li>Implemented a CSS baseline</li><li>General component updates</li><li>Updated the Accordion component</li><li>Updated the Anchor component</li><li>Updated the Button component</li><li>Updated the Icon component</li><li>Added a GlobalState service</li></ul><h3>Documentation and example changes</h3><ul><li>Extended dark/light theme settings with an accent color selection</li><li>Updated and enhanced the DemoSection component</li><li>Improved the APIDocumentation component</li><li>Added a sample data service</li><li>Added an ‘Incubation lab’ section where we offer examples of site building components and potential new library components</li></ul><h3>Library changes</h3><p>Let’s start with the changes we have made to the library itself.</p><h3>DataGrid component</h3><p>With regards to the implementation of the grid that was is in our package until now, we followed what was ‘prescribed’ by the fluent-data-grid. We wrapped the fluent-data-grid, fluent-data-grid-row and fluent-data-grid-cell and their attributes (parameters on the Blazor side) and by doing so styling and rendering is taken care of (by the web components). For adding capabilities to the grid, we copied over a lot of the principles and code from the <a href="https://github.com/BlazorFluentUI/BlazorFluentUI">BlazorFluentUI</a> package. In that process, some things were renamed to better align with the Web Component internals (like ColumDefinition). The result was nice but a bit clunky in the way the columns were defined. Also, sorting, etc. seemed to be more of an afterthought. We have a solution for all these problems now by leveraging the strengths of the ASP.NET Team&#39;s QuickGrid implementation.</p><p>For the 2.0 version of the grid, we basically took this QuickGrid implementation, swapped out its rendering to use the &lt;FluentDataGrid&gt; components and renamed a lot of the parameters to keep in line with what we were already using on the Fluent UI side. By doing so, we completely broke <strong>every</strong> &lt;FluentDataGrid&gt; implementation out there. Please be aware of this when you upgrade. You can use the examples provided in <a href="https://aka.ms/fluentui-blazor">the demo site</a> to guide you in how to move to using the new implementation. Also, by doing this, you can now use <strong>all</strong>* of the great functionality being offered by the QuickGrid. Please take a look at the <a href="https://aspnet.github.io/quickgridsamples/">QuickGrid for Blazor site</a> to see what else is possible.</p><p>*The o<em>nly thing we did not copy over is the </em><em>Theme parameter and functionality as the whole point of this library is to have a theme implemented already...</em></p><p>In its simplest form, the end result in code would go from this (which does <strong>not </strong>come with any sorting capabilities):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f75d5a669587d20283ef6ac39a067566/href">https://medium.com/media/f75d5a669587d20283ef6ac39a067566/href</a></iframe><p>to this (with sorting capabilities <strong>baked in</strong>):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9149b1a7f0042631392edfcb794b7062/href">https://medium.com/media/9149b1a7f0042631392edfcb794b7062/href</a></iframe><p>Quite an improvement, we think.</p><p>An example implementation:</p><figure><img alt="An image of an example &lt;FluentDataGrid&gt; implementation" src="https://cdn-images-1.medium.com/max/1024/1*gKBo9oLrc7GjqJuzpTXVUg.png" /></figure><h3>Listbox, Select, and Combobox component updates</h3><p>Earlier versions of these components did not really work well in cases where you wanted to do binding or set pre-selected values. There were also no good examples on how to use the components. And the examples that did exist, assumed that the data shown would come from separate options instead of being inferred from a programmatically supplied list. We have now re-implemented these three components from the ground up (sharing a common base implementation) and are here again making <strong>breaking changes</strong>! We’ve also made a lot of examples of the components’ usage available in the demo environment.</p><p>For the Combobox, you can now bind to the Value instead of to the text of an option. If you type a value instead of selecting an option from the list, the Value will reflect that.</p><p>For the Listbox and Select, you can bind to the Value but also to the (strongly typed!) SelectedItemor SelectedItems (multiple not working for Listbox yet because of an issue in the underlying web component).</p><p>Example of a multi-select implementation:</p><figure><img alt="An image of a multi-select implementation" src="https://cdn-images-1.medium.com/max/1014/1*FadbqeZsicklDLo_Acvpew.png" /></figure><h3>A CSS baseline</h3><p>We’ve received quite some feedback from users that they would like to have more tools and components available that help them with layout of sites and applications. Although we sympathize with the idea, it does not really align well with the goal of this library: to provide a Blazor wrapper for the Fluent UI Web Components. That being said, we thought about how to accommodate this wish while staying in line with the goal set. We think we’ve come up with a good middle ground. More on that later..</p><p>So why are we bringing this up here? We want to make sure the components look as good as possible in every browser, site, and application, wherever the layout is defined. To help you in achieving this, we’ve added a CSS baseline named Reboot to the library which you can build upon. The CSS we provide is based on <a href="https://getbootstrap.com/docs/5.2/content/reboot/">Bootstrap&#39;s Reboot</a> solution (which in turn is based on <a href="https://github.com/necolas/normalize.css">Normalize</a>). Using the baseline is completely optional and it is entirely possible to build a site without using Reboot. If you want to use Reboot, like the demo site, you&#39;ll need to include it in your index.html or _Layout.cshtml file like this:</p><pre>&lt;link href=&quot;_content/Microsoft.Fast.Components.FluentUI/css/reboot.css&quot; rel=&quot;stylesheet&quot; /&gt;</pre><p>If you choose not to use it, please do add the variables.css file (which is otherwise imported through the reboot.css file) to your index.html or _Layout.cshtml file like this:</p><pre>&lt;link href=&quot;_content/Microsoft.Fast.Components.FluentUI/css/variables.css&quot; rel=&quot;stylesheet&quot; /&gt;</pre><p>This file contains a number of CSS variables that are required to be defined for some of the components to work correctly.</p><p>See the Reboot page in <a href="https://aka.ms/fluentui-blazor">the demo site</a> for more information.</p><h3>General component updates</h3><p>We’ve added two parameters to the &lt;FluentUIComponentBase&gt; component to make them available to every component in the library. The added parameters are:</p><ul><li>Class; This enables you to add (optional) CSS class names. If given, these will be included in the class attribute of the component.</li><li>Style; This enables you to add (optional) in-line styles. If given, these will be included in the style attribute of the component.</li></ul><p>Utility CssBuilder and StyleBuilder (based on <a href="https://github.com/EdCharbeneau/BlazorComponentUtilities">EdCharbeneau/BlazorComponentUtilities</a>) implementations have been added to make it easier to compose values for these parameters. Examples of using this can be found in the source code.</p><p>We removed the ChildContent parameter from the base class and moved it down to the components themselves. This is done to make it possible to have components without any child content and/or have components with multiple content sections.</p><h3>Accordion component updates</h3><p>With earlier versions of the library, we added event handling code to several components. Due to some missing code in the underlying web components, event handling had not been added to the &lt;FluentAccordion&gt; component yet. This code has now been added and this allows you to detect the last changed accordion item. The example in the demo site has been enhanced to showcase this behavior.</p><h3>Anchor component updates</h3><p>One of the things that do not play nice in most SPA application frameworks are hyperlinks with bookmarks. This is due to the way the router mechanism works in these frameworks. Blazor is no exception here, so the &lt;FluentAnchor&gt; component could not be used to jump to a specific spot on a page earlier. With this version, a fix has been implemented that enables these jumps to work as expected. This is being used heavily in the new table of contents component that is now shown on every content page in the demo site. The fix also takes into account any <a href="https://github.com/WICG/scroll-to-text-fragment/">text fragments</a> in a link with a bookmark.</p><h3>Button component updates</h3><p>We’ve added a ButtonType enumeration to the library and are using this now in the &lt;FluentButton&gt; component to denote the type of button (it was a string parameter before). The default value for the type is Button. (The other available options are Submit and Reset)</p><h3>Icon component updates</h3><p>There are a number of breaking changes for the &lt;FluentIcon&gt; component. Upgrading to version 2 of the library means you will need to review <strong>all</strong> used icons carefully. The changes are:</p><ul><li>We’ve updated &lt;FluentIcon&gt; to support more colors. A Color enum has been added for this. The UseAccentColor parameter has been removed for this.</li><li>It is now possible to use a custom color for rendering an icon. A CustomColor parameter has been added for this (and can only be used when the Color parameter has been set to Color.Custom)</li><li>The Filled parameter has been replaced with an IconVariant enum (with possible values of IconVariant.Filled or IconVariant.Regular (default))</li></ul><p>To prevent icons from being requested and downloaded on each and every &lt;FluentIcon&gt; call, a caching mechanism has been added. This leverages the standard <a href="https://developer.mozilla.org/en-US/docs/Web/API/Cache">Cache Web API</a> which is supported by every modern browser. Icons downloaded to the cache have a (non configurable) validity of 7 days. After that period, an icon will be re-downloaded from the server.</p><p>Example of rendering icons with a specific color:</p><figure><img alt="Icons rendered with a specific color" src="https://cdn-images-1.medium.com/max/910/1*YeNEGd3YRTdpVa8pcmm4sg.png" /></figure><p>There have also been a couple of releases of the underlying Fluent UI System Icons library since our last version shipped. We have merged these releases into version 2 now. The latest update we’ve synced up with is 1.1.187.</p><h3>GlobalState Service</h3><p>A GlobalState class has been added to the library which is added to the Services container automatically. At the moment the service contains two properties that you can use within your own code. These are Luminance and Dir, and give you access to the state of the current theme (light or dark) and the direction of the content (left to right or right to left). Both properties also come with a Set... method that raises a notification that you can subscribe to in your code. An example of this can be found in the CounterBadge component (see below).</p><h3>Documentation and example site changes</h3><p>With this version, we continued to enhance the documentation and examples in the demo sites. The Web Assembly version of the site is always available at <a href="https://aka.ms/fluentui-blazor">https://aka.ms/fluentui-blazor</a>. If you clone or download the repository, you can choose to run either the Web Assembly or Server version of the site locally. In the sections below, we’ll describe the enhancements we made to these sites in more detail.</p><h3>Updates and enhancements to the DemoSection component</h3><p>A key component (no pun intended) to the demo site is the DemoSection component. Is has been greatly enhanced and now displays example, source and other related files (.cs, .css, .js), if any, in a tabbed fashion. This way examples are no longer stretched out to long listings of source code. Another new functionality of the component is that it now presents download options for all the files that make up the example. This way we hope to make it easier to re-use the examples in your own projects. Just remember to replace the namespace we use in the examples with your own project&#39;s namespace.</p><p>As a last change, the code highlighting part of the DemoSection has now been made theme-aware.</p><h3>Improved APIDocumentation component</h3><p>The information on all of the component’s parameters is being generated from the XML documentation (which gathers all source code comments). We built an APIDocumentation component to display this information. This component has now been enhanced to get descriptions from a components&#39; base class. Also, the documentation generation for generic components has been greatly improved.</p><h3>Add Color (‘theme’) selection to the site</h3><p>Finally, as a last visual change to the demo, we added a color selection to choose a different accent color to use. This works in tandem with the Light/Dark switch and shows how Design Tokens can be used to influence how components are being rendered.</p><blockquote><em>The colors in the selection list come from an enumeration (called </em><em>OfficeColor) that has been added to the library (and not just to the demo environment). The enumeration contains the RGB hex color codes for 17 different Office applications.</em></blockquote><h3>Incubation Lab</h3><p>To show the art of the possible, test out new things, and address the ask around tools and components that can help with the layout of sites and applications, we’ve added an ‘Incubation Lab’ section to the demo environment. By leveraging the download options described earlier, we hope to make it easy for you to test and use these components in your own environments.</p><blockquote><em>The components we showcase in the Lab are </em><strong><em>not</em></strong><em> part of the official library and are </em><strong><em>not</em></strong><em> included in the NuGet package. We only support these specific components on a best effort base through our </em><a href="https://github.com/microsoft/fast-blazor/"><em>GitHub repository</em></a><em>.</em></blockquote><h4>Layout components</h4><p>The following components have been added to aid developers in building layouts for sites and applications:</p><ul><li>Header</li><li>Footer</li><li>BodyContent</li><li>Layout</li><li>MainLayout</li><li>Spacer</li><li>Stack</li></ul><p>Using (most of) them together can yield something like this:</p><figure><img alt="An example layout created with the demo components" src="https://cdn-images-1.medium.com/max/899/1*WZ1asYokZKV47B_QIYxGEA.png" /></figure><p>Please see the demo site for more documentation and usage examples.</p><h4>Other components</h4><p>We’ve added some components that we think could be useful. They showcase how to wrap or build upon existing components, combine components with custom code and/or JavaScript, or just how to create something completely new. We hope you will help us test-drive these components, both in the demo environment but also in your own projects, and provide us with feedback.</p><ul><li>NavMenu, NavMenuGroup, and NavMenuLink <br>These components show how to wrap the existing &lt;FluentTree&gt; and &lt;FluentTreeItem&gt; components to build a (collapsible) navigation menu. See the left side of the image above for an example</li><li>CounterBadge <br>The CounterBadge component is used to display a notification count on top of another component:</li></ul><figure><img alt="CounterBadge component example" src="https://cdn-images-1.medium.com/max/57/1*30WRhljg4wRBJ9gx68owNw.png" /></figure><ul><li>PresenceBadge <br>The PresenceBadge component is used to display a status indicator such as available, away, or busy.</li></ul><figure><img alt="PresenceBadge component examples" src="https://cdn-images-1.medium.com/max/380/1*xt0r28cCQE71oNhwGsUeTA.png" /></figure><ul><li>MenuButton <br>The MenuButton component shows how easy it is to combine two other Fluent components (&lt;FluentButton&gt; and &lt;FluentMenu&gt;) in a new component with its own specific funtionality</li></ul><figure><img alt="MenuButton component example" src="https://cdn-images-1.medium.com/max/206/1*TXLkIS9DZTpZY7-hlkBmtA.png" /></figure><ul><li>Table of Contents <br>The TableOfContents component uses an existing component (&lt;FluentAccordion&gt;) together with some custom code and JavaScript interop. The JavaScript scans the article-section of a page for all h2, h3 and h4 headings and the custom code presents them as a table of contents with clickable links to those headings in an accordion component.</li></ul><figure><img alt="TableOfContents component example" src="https://cdn-images-1.medium.com/max/279/1*bIWjcCQPRaBcPXOqCHLwrQ.png" /></figure><h3>Next steps</h3><p>As describe earlier, we have made the RC1 version of the package <a href="https://www.nuget.org/packages/Microsoft.Fast.Components.FluentUI/2.0.0-rc-1">available on NuGet</a>. Please try it out in your own projects and let us know what you think. Also, please report any issues you find in the GitHub repository. Let’s work together to make this a great new major version!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b3ac0eb5d02c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-2-0-b3ac0eb5d02c">What’s new in the Microsoft Fluent UI library for Blazor version 2.0</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in the Microsoft Fluent UI library for Blazor version 1.6]]></title>
            <link>https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-1-6-eb598e47ff1?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/eb598e47ff1</guid>
            <category><![CDATA[blazor-components]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[fluent-ui]]></category>
            <category><![CDATA[blazor]]></category>
            <dc:creator><![CDATA[Vincent Baaij]]></dc:creator>
            <pubDate>Wed, 09 Nov 2022 00:08:38 GMT</pubDate>
            <atom:updated>2022-11-09T00:08:38.385Z</atom:updated>
            <content:encoded><![CDATA[<h3>Extended .NET support</h3><p>We’ve updated the project to not only compile with the latest version of .NET 6 but also with the new .NET 7 (generally available as of today!). If you would examine the NuGet package, you’ll see that as of this version there are two DLL’s available:</p><figure><img alt="NuGet explorer view of the Fluent UI package" src="https://cdn-images-1.medium.com/max/776/1*SfdRO0gGH4mbvJv8LKufEw.png" /></figure><p>Depending on the Framework version you choose when creating a new project, the correct version of the Fluent UI library will automatically be chosen when you add this package to your project.</p><p>There is unfortunately no good way yet to use version specific code in .razor files (like you can in C# with #if preprocessor directives). This means we are not using any of the specific new Blazor functionality like @bind:after at the moment. We are working with the ASP.NET team to see how a better experience can be offered for this moving forward.</p><h3>Icon updates</h3><p>We’ve updated the Fluent UI System Icons to the latest available version (1.1.186). A lot of new icons have been added and updated since the 1.5.3 release of our library.</p><p>To make it easier to use the FluentIcon component in your own application, you can now get a ready-to-paste component declaration from the demo environment. It works like this:</p><ul><li>Go to <a href="https://aka.ms/fluentui-blazor/Icon">https://aka.ms/fluentui-blazor/Icon</a></li><li>Type a search term, select a size and select whether you want filled and/or regular variants and click on ‘Search’. For example:</li></ul><figure><img alt="Search for an icon screen" src="https://cdn-images-1.medium.com/max/1012/1*lqmxJM0n1PgeUK8nkfcCNw.png" /></figure><ul><li>In the results, click on the icon card you want to get a component declaration for which you can paste in you own .razor file. You will get a notification of the copy action:</li></ul><figure><img alt="Copied icon component declaration notification" src="https://cdn-images-1.medium.com/max/448/1*eiueQnV3DOSnAslNh1yfeg.png" /></figure><ul><li>Now, where you want to use this icon, paste from the clipboard. In this example it will insert &lt;FluentIcon Name=&quot;@FluentIcons.Washer&quot; Size=&quot;IconSize.Size32&quot; Filled=true /&gt;. Of course, you can edit/change this to your specific needs after pasting.</li></ul><p>We hope this makes it a bit easier to choose from the set of over 12.5k available icons. Oh, and if you clone this repository and would like to know how you can update to later releases of the Fluent UI System Icons yourself, we’ve added instructions on how to do that in the ‘Update Icons.md’ file which you can find in the root of the repository</p><h3>AOT compilation fix</h3><p>Having all these icons available in an easy-to-use format, means you need to have some sort of structure in your code that is read and exposed to the developers at run time. This is done by a source generator which spits out a huge List. This however did not play nice with AOT compilation (see <a href="https://learn.microsoft.com/en-us/aspnet/core/blazor/host-and-deploy/webassembly?view=aspnetcore-6.0#ahead-of-time-aot-compilation">Ahead Of Time in the docs</a>). The dotnet publish command would just error out.<br>Investigation led us to this List as being the culprit of the error. In this release the structure has been changed to use a fixed-size array and with that we could successfully use AOT compilation again.</p><h3>Other changes</h3><p>Since our last minor release (1.5.0), we’ve done some bug fixing. We also made some other more noteworthy changes. Most notably, a lot of work has been put into the demo site and the component documentation. To sum these up:</p><ul><li>The design has been tuned to work better on mobile and tablet devices (with a special layout for Surface Duo devices!).</li><li>We added (a lot) more comments to the source code and use this information for displaying the API documentation. With this change that documentation will now always stay up-to-date automatically.</li><li>We added highlight functionality to the code samples and added a copy button to make it easier to re-use a sample in your own project.</li><li>We checked each and every component and enumeration against the FAST and Fluent UI Web Components to make sure all parameters and enums are available and correct.</li><li>We split out every example to a separate file and added more structure to the Pages folder by moving each sample page to its own folder.</li></ul><h3>Looking ahead</h3><p>While working on this release, we’ve also been working hard on other things. More specifically, version 2 of this library. Why a new major version you might ask. That’s because we are making some big (and breaking) changes. To name a few:</p><ul><li>Integrating the ASP.NET Team’s <a href="https://aspnet.github.io/quickgridsamples/">QuickGrid</a>. Almost all of its functionality will be available in a Fluent UI design (breaking current FluentGrid implementations).</li><li>Completely redo FluentCombobox, FluentListbox and FluentSelect as current implementations do not work well (breaking current implementations of these components).</li></ul><p>More will be documented in an upcoming post. We do not have a firm timeline on V2 yet. If you want to try it out right now, a <a href="https://www.nuget.org/packages/Microsoft.Fast.Components.FluentUI/2.0.0-beta.1">first beta package is available on NuGet</a>. We will release updates to this regularly and make it generally available once we believe it is ready. We can certainly use your help in testing out all the new functionality and reporting issues on where we have not done it completely right yet. Thanks in advance!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb598e47ff1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-1-6-eb598e47ff1">What’s new in the Microsoft Fluent UI library for Blazor version 1.6</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolution of design tokens and component styling, part 2]]></title>
            <link>https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-2-1018e8bae62?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/1018e8bae62</guid>
            <category><![CDATA[token-design]]></category>
            <category><![CDATA[design-to-code]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Brian Heston]]></dc:creator>
            <pubDate>Mon, 19 Sep 2022 17:07:36 GMT</pubDate>
            <atom:updated>2022-09-19T17:07:36.011Z</atom:updated>
            <content:encoded><![CDATA[<p>In <a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e">part 1</a> we looked at what design tokens are, touched briefly on how the concept has evolved through different toolsets, and looked at some of the benefits they bring, as well as some areas of concern where they don’t quite solve the whole problem of design yet. In this post we’ll look at how we’ve addressed a few of those concerns in <a href="https://www.fast.design/">FAST</a>.</p><h3>Design tokens in FAST</h3><p>Designers solve many different problems across various categories of experiences. Many of us on FAST have found over the years working on numerous component frameworks that no matter how much time and planning is put into defining a system of guidance and components, there will inevitably be scenarios that challenge it. If the system is too limiting, consuming teams will go with whatever makes sense for the constraints involved at the time, often ignoring the system entirely, or building in such a way that when the system changes, they are left behind.</p><p>Design<em> systems</em> implemented primarily through design<em> tokens</em> don’t go far enough in conveying the reasons behind — and relationship between — individual tokens. They are typically a big graph of manually-derived values with a very specific way they are expected to be used. We sought to build a framework for design<em> decisions</em> that describes the design <em>intent</em>, with hooks that allow for scaling to any unique needs of each problem being solved. Individual <em>decisions</em> can be remixed to create new but cohesive experiences. Reducing friction in the <em>system</em> speeds up <em>product</em> development. Designing the <em>system</em> for flexibility keeps the <em>product</em> more aligned with the system intent, with specific and apparent “earned” variations.</p><p>Another goal of this system is to evolve the conversation and expectations of design. Many expressions of the design decisions open possibilities to better support individual humans using your product, not limiting the experience to a one-size-fits-<em>some</em> visual design. It’s a new frame of reference compared to traditional design, but the possibilities and advantages become apparent once you’re familiar with the foundation.</p><h3>Adaptive UI and recipes</h3><p>FAST introduced an industry-first design token concept called Adaptive UI. Adaptive design tokens, backed by a “<strong>recipe</strong>”, produce a variable result by calling a function (the “<strong>algorithm</strong>”) with input parameters, which may be other design tokens. This structure is not much different than the typical chain or aliasing of plain design tokens.</p><figure><img alt="Diagram of a general design token chain from algorithm, to recipe, to token, to component" src="https://cdn-images-1.medium.com/max/1024/1*AziMEwW_5kj9pd11iAkuYw.png" /></figure><p>A straightforward example of the need for an adaptive recipe is for the color of “<strong>hint</strong>” (or “secondary”, “placeholder”, or “metadata”) text. Due to accessibility requirements, text color must always meet <a href="https://www.w3.org/TR/WCAG21/#contrast-minimum">4.5:1 contrast</a> relative to its container’s fill color.</p><p>There are many different possible background colors, including main app surfaces, layering, flyouts or dialogs, cards, and banners. There are also gradients and images, and of course both light and dark mode.</p><p>The <em>recipe</em> in this example, or the way you would describe the need or decision, is simply to find a color that meets contrast. The recipe is not “<strong>grey-40</strong>” or some fixed color palette reference that works for only one scenario. Manually picking colors is not a scalable approach for guaranteed <em>accessibility</em> (among other factors). Limiting allowable background colors is not a realistic or scalable approach for <em>design</em>.</p><p>Here’s a sample “Person card” component with “hint” text applied to the second line, illustrated in different possible realistic containers:</p><figure><img alt="A “person card” component with two labels, the second of which uses a light color text, placed over four backgrounds each in light and dark mode" src="https://cdn-images-1.medium.com/max/648/1*APowySqGus6m2utEiVPI0w.png" /></figure><p>To solve this in Adaptive UI, the “<strong>neutral-foreground-hint-recipe</strong>” relies on the “<strong>contrastSwatch</strong>” algorithm, which simply returns a color meeting the specified contrast. This recipe specifies the desired palette (<strong>neutral</strong>), the reference color (the container’s <strong>fill color</strong>), and the minimum contrast value (<strong>4.5</strong>). It’s wrapped by the “<strong>neutral-foreground-hint</strong>” token, which is applied to UI elements in the component styles. A component can now be implemented without knowing the context of where it can be safely used, and the design intent (contrast requirement) will always be correct.</p><figure><img alt="Diagram of a specific implementation of the previous general algorithm to component token chain" src="https://cdn-images-1.medium.com/max/1024/1*ZC_zgqmgk3gaSrqZARrG2w.png" /></figure><p>Without Adaptive UI, one common attempt to solve this is with color pairs, like “<strong>banner-background</strong>” and “<strong>hint-on-banner-background</strong>”. The reason this doesn’t scale well is that any new use case requires a new color pair, and any components that are composed of “<strong>hint</strong>” text now need to be aware of the context in which they are used (in a banner, dialog, etc.). The various placements of the “Person card” above illustrate how this model breaks. We would need at least four different color pairs. Also, the component would need to know <em>where</em> it’s being placed, or the page author would need to know which <em>design tokens</em> the component is using to override them individually.</p><figure><img alt="Same “person card” component, illustrating broken contrast over a blue background" src="https://cdn-images-1.medium.com/max/584/1*UYH6azDIKPlPbe2WStWxvw.png" /></figure><p>With this example we can see how adaptive recipes address the issue of <a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e#36a9">breaking something downstream by changing a design token value</a> — we don’t need to tweak the “<strong>foreground-hint</strong>” token to get it to work for a particular placement because the recipe determines the correct value based on context.</p><p>Let’s track how FAST addresses the original concerns around using design tokens from the first post:</p><figure><img alt="Illustration of the seven concerns described in the first post, with “break downstream” checked as addressed" src="https://cdn-images-1.medium.com/max/740/1*-FfLFJEEWCZ9womldbLNJg.png" /></figure><h3>Recipes can describe any design behavior</h3><p>Of course, we didn’t build Adaptive UI only for 4.5:1 text contrast. Color is a good example because it’s easy to visualize and advanced use cases can’t be solved with CSS functions, but the model scales to any other design values you might need — relational type ramps, adjustable density through padding and spacing, animation, focus indication, elevation treatment, strokes, shape, and whatever else you can imagine within the scope of web design.</p><p>Recipes can be built around the context of a group or set of tokens and values. Consider a type ramp. Often the tokens will be indexed like “<strong>font-size-1</strong>”, “<strong>font-size-2</strong>”, “<strong>font-size-3</strong>” or using <a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e#4179">t-shirt sizes</a> like “<strong>typescale.small.size</strong>”, “<strong>typescale.medium.size</strong>”, and “<strong>typescale.large.size</strong>”. The values for each token were chosen with intention. There is a size which should be used for body text, and other sizes relate to the body text for a cohesive heading and caption design. In the tokens above, the body size is probably “<strong>2</strong>” or “<strong>medium</strong>”, but that’s not conveyed through the naming convention, which can lead to not knowing how to use them. One way to handle this is by aliasing the base type ramp sizes to usage, like “<strong>caption</strong>”, “<strong>body</strong>”, “<strong>heading</strong>”, etc. This is a start, but it would be even better if the underlying ramp conveyed the intent.</p><p>When it comes to text, it’s important that your content is clearly readable for your customers. It’s probably also desirable that the treatment is consistent across your experience. People all have different visual needs, but unfortunately sites and apps don’t apply font sizes consistently. A <a href="https://spencermortensen.com/articles/typographic-scale/">modular scale</a> is a great way to relate font sizes to each other and it also helps solve this problem. If you aren’t familiar with this model, it’s probably what you’re approximating by eye anyway.</p><p>A modular scale requires some basic math, which can be implemented as a recipe. One input is a “<strong>base</strong>” type size token that represents the size of the body text. Another input represents the “<strong>scale</strong>” of the relationship between sizes on the ramp. The output are adaptive tokens that calculate individual sizes relative to the base, like “<strong>-1</strong>”, “<strong>+1</strong>”, or “<strong>+2</strong>”. Your site can maintain the design intent by keeping the “<strong>scale</strong>” constant but address your customer’s visual or accessibility needs by allowing them to adjust the “<strong>base</strong>” size for readability.</p><figure><img alt="Sample article with “base” body text and three levels of headings" src="https://cdn-images-1.medium.com/max/750/1*lEhSp3fb5ehdbeHrAm9DeA.png" /></figure><p>If your eyes get tired after a long day of staring at a monitor, what if you could increase the font size slightly in the evening hours while maintaining the overall relationship?</p><figure><img alt="Same sample article with increased “base” size and same relationship for headings" src="https://cdn-images-1.medium.com/max/750/1*EcQuiqcdHEVj5o4jeaZw8A.png" /></figure><p>With an adaptive type ramp we can move on to more prominent issues than whether a 13, 14, or 15px font size is best for readability.</p><p>I think a model like this conveys the intent a lot more with a solid foundation in naming the ramp.</p><figure><img alt="Same illustration of the seven concerns described in the first post, adding “t-shirt sizes” checked as addressed" src="https://cdn-images-1.medium.com/max/740/1*ZtQksrKV2CN2lbvoGvTB6w.png" /></figure><h3>Hierarchical overrides</h3><p>One of the key features of Adaptive UI is the ability to set the value of a design token for any component within the document hierarchy.</p><p>Let’s look at the density system for an example of nesting and overriding token values.</p><figure><img alt="Simple marketing site with “spacious” density and “normal” density sign in form to the side" src="https://cdn-images-1.medium.com/max/740/1*9xYtSpGlOHkk866mz-vmYw.png" /></figure><p>Here we have a marketing site where the design intent is to give the main content some room to breathe. We’ve increased the “<strong>density</strong>” by “<strong>+2</strong>”, which has increased the padding within the components and the spacing between them.</p><p>We also have a sign in form, but the design intent is for that to be secondary and follow the default “<strong>base</strong>” density of “<strong>0</strong>”. These are the same components — same Button and Text field — which can intelligently size themselves by adaptive density. But the density is not inherent to the sign in form, as it might be if we had built the Button and Text fields with t-shirt sizes like “<strong>small</strong>”, “<strong>medium</strong>”, and “<strong>large</strong>”. What if we want to use that same sign in form on a dedicated page? Here’s the same form with only a single design token value changed.</p><figure><img alt="Same sign in form on its own page with “spacious” density" src="https://cdn-images-1.medium.com/max/740/1*vtmaTgiCpIATjEG1cSpOuw.png" /></figure><p>To further this example, perhaps there is a footer that is more compact and uses a “<strong>density</strong>” like “<strong>-1</strong>” or “<strong>-2</strong>”. Again, the same components would be smaller and closer together using the default system. This system works with relative or absolute values. That is, the sign in form could be fixed to use the “<strong>base</strong>” density, or it could be specified to use relative “<strong>-2</strong>” density compared to its container.</p><p>Implementing relative values like this using CSS functions would be messy because there is no way to get the parent value. You’d have to build it with fixed levels and wouldn’t be able to recompose your components.</p><p>For a longer discussion on type ramp sizes and density and the relationship between display scaling or zooming, see my planning for the <a href="https://github.com/microsoft/fast/issues/5510">density system</a>.</p><p>I hid another scenario in here, which is that the buttons and fields have a subtle drop shadow. This comes from the “<strong>elevation-recipe</strong>”, which takes a parameter for the “<strong>size</strong>” of the elevation and creates a blurred box-shadow. Recipes are just design tokens and have the same features. Here is what we can do if we override the “<strong>elevation</strong>-<strong>recipe</strong>” itself and provide a new implementation.</p><figure><img alt="Same marketing site with sign in form with elevation shadow swapped to a bolder visual treatment" src="https://cdn-images-1.medium.com/max/740/1*VsCA-_2qmL_5Lvj_7jshPw.png" /></figure><p>The box shadow is now horizontally offset with no blur. Because we changed the recipe instead of the direct token value, we automatically get the same scale of elevation treatment in both appearances — the plain input fields have a smaller elevation “<strong>size</strong>” than the buttons.</p><p>This model of overriding values can be done for any token in any of the adaptive systems you use or create.</p><p>Recipes can support light and dark theming as we saw with “hint” text, or more advanced theming like custom elevation shadows.</p><figure><img alt="Same illustration of the seven concerns described in the first post, adding “theming” checked as addressed" src="https://cdn-images-1.medium.com/max/740/1*rlLZ7l3f9dNgtiTpP7PlJA.png" /></figure><h3>Declaring design decisions</h3><p>There’s another scenario in the previous example, which is the accent color used on the buttons. In the marketing site the default brand color used for the CTAs is green. On the sign in form the accent color has been overridden to blue.</p><p>One of the issues I mentioned in the first post is the <a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e#26c5">loss of underlying decisions</a>. In that example we look at different colors of buttons and how the application of rest and hover state is inconsistent. One possible model using Adaptive UI is similar to the “hint” text color example at the start of this post, but in this case for a <em>set</em> of related colors, using the “<strong>contrastAndDeltaSwatchSet</strong>” algorithm.</p><figure><img alt="Diagram of the “accent fill” algorithm to component token chain" src="https://cdn-images-1.medium.com/max/1024/1*M6R4DuF0GyK3Vvz2tbNqHQ.png" /></figure><p>The design <em>decision</em> is that buttons darken on hover. This is captured in the value for the “<strong>accent-fill-hover-delta</strong>” token, “<strong>2</strong>”, meaning 2 steps darker on the “<strong>accent-palette</strong>” (it’s helpful to visualize a palette going from white to black, left to right). The <em>decision</em> for the “<strong>rest</strong>” color is to have contrast of at least 5.5:1, and I’ve added here that the “<strong>active</strong>” state is lighter than “<strong>rest</strong>” with a value of “<strong>-2</strong>”.</p><p>The “<strong>accent-palette</strong>” <em>recipe</em> gets the “<strong>accent-base-color</strong>” token as a parameter, so we can simply change that single token and the other decisions flow automatically as expected. Regardless of the accent color, the hover and press states use the same design <em>decisions</em>, but with colors derived using the specified base color.</p><p>So we can finally answer that question about colors for an orange button:</p><figure><img alt="Orange color palette with rest and hover button colors determined by the recipe" src="https://cdn-images-1.medium.com/max/450/1*a-wo5ox8aUG82I-gRL3zgA.png" /></figure><p>Just to note, a palette in Adaptive UI is not built for human pattern recognition because the recipes are applying their rules rather than a human needing simplicity and consistency — that is, knowing there are always 10 colors and colors up to “40” are contrast-safe against white, etc. I’ve simplified the palette here to align it more with the initial concern, but under the default settings there are many more colors. In fact, what’s most important, since some recipes use deltas or offsets to pick stateful colors, is the contrast <em>between</em> each color on the palette. If you want your red and green buttons to <em>feel</em> the same when you hover or press them, you need consistent contrast between the swatches. Someday I’ll write a whole post about color palettes.</p><p>Now we can check off using underlying design decisions to produce token values.</p><figure><img alt="Same illustration of the seven concerns described in the first post, adding “track decisions” checked as addressed" src="https://cdn-images-1.medium.com/max/740/1*yYpdoushi6ZZGcOHCsBVqw.png" /></figure><h3>Notification of changes</h3><p>The “adaptive” part of the recipes also allows for the output to change in real time according to any input you can imagine — for example, weather, time of day, favorite color, unique accessibility needs, unread email count, or stock market performance. The design token infrastructure is built on an observable pattern, so recipes receive notification when a dependent token changes.</p><p>Extending the “hint” text contrast example from earlier, we used the value of “<strong>4.5</strong>” for standard AA contrast requirements. What if we wanted to support the “prefers increased contrast” preference and a WCAG AAA rating with “<strong>7:1</strong>” contrast? With the color recipe we can simply use a “<strong>foreground-hint-contrast</strong>” token and change the value from “<strong>4.5</strong>” to “<strong>7</strong>” when someone enables that option, everywhere that recipe is used will update to the new color automatically.</p><figure><img alt="Same “person card” illustration with contrast increased to 7:1" src="https://cdn-images-1.medium.com/max/648/1*6sYhcOmGrxY8dLv_rYVt1A.png" /></figure><p>Hopefully it’s becoming apparent how solving the next wave of key design and accessibility problems requires algorithms and effort, and how we’ll never get there with traditional design definitions, even as we start using design tokens.</p><p>In part 3 (coming soon) we’ll look at ways to solve some of the remaining concerns with an idea I’ve been calling “modular styling”, some design-to-code tooling, and improvements using the JSON tokens format.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1018e8bae62" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-2-1018e8bae62">Evolution of design tokens and component styling, part 2</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When to use when?]]></title>
            <link>https://medium.com/fast-design/when-to-use-when-6e26ce7637ba?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/6e26ce7637ba</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[conditional-statements]]></category>
            <category><![CDATA[microsoft]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Wendy Hsu]]></dc:creator>
            <pubDate>Mon, 29 Aug 2022 16:10:31 GMT</pubDate>
            <atom:updated>2022-08-29T16:10:31.623Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nlOCB-LXTu1xRwNwv3i5Aw.png" /><figcaption>Colleagues having a discussion.</figcaption></figure><p>Directives are a great way to increase your efficiency when composing templates. But just because they are available, it does not mean they should be used in every scenario. Misusing these can have performance implications and clutter your codebase. In this post, let’s take a closer look at the <strong>when</strong> directive and compare different conditional cases.</p><p>If you are not familiar with FAST directives, take a look here: <a href="https://www.fast.design/docs/fast-element/using-directives">Using Directives | FAST</a>.</p><p>According to the documentation, the when directive enables you to conditionally render blocks of HTML. In other words, it is another way of writing if (condition) { //do something } .</p><h4>Good use case</h4><p>This is an example of using if (condition) { //do something } to render our <em>happyTemplate</em> based on the value of the <em>happy </em>property :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/db69721cd707054fbc828b2eab5d715c/href">https://medium.com/media/db69721cd707054fbc828b2eab5d715c/href</a></iframe><p>With the when directive, we can achieve the same condition check and reduce the if (condition) { //do something } to just one line of code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5406fd861c820bea74b1b8a01f646866/href">https://medium.com/media/5406fd861c820bea74b1b8a01f646866/href</a></iframe><p>Doesn’t this small refactor make you happy?</p><p>The when directive is great for the replacement of a single if (condition) { //do something }. The value provided here is making the block of code less verbose.</p><p>How about performance? Let’s run some benchmarks comparing these two implementations.</p><p><em>NOTE: All benchmarks are run with</em><a href="https://github.com/microsoft/fast/tree/master/packages/utilities/fast-benchmarks"><em> fast-benchmarks</em></a><em>, and the sample size for each benchmark is 50 with auto-sampling turned on. For a little more context, when we compare 2 versions, a minimum of 100 samples will be run in total. With auto-sampling set at 1 minute, samples will keep increasing until it hits the 1-minute mark.</em></p><p><em>local version — </em>represents if (condition) { //do something }<br><em>master version — </em>represents when directive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9AL2EXFrD1yfE0EathMkIA.png" /><figcaption>benchmark results between if and when for one condition</figcaption></figure><p>To summarize the results:</p><ol><li>The blue boxes indicate that between the 2 implementations, there was <strong>no</strong> statistical performance difference in <em>javascript execution time</em> and <em>memory consumption</em>.</li><li>The green boxes show that if (condition) { //do something } bundle size turns out to be <strong>more than</strong> — <em>129.86kb </em>compared to the<em> 129.80kb — </em>when directive</li></ol><p>These results show that using the when directive here provides better readability and slightly improved bundle size. This is primarily the purpose of the when directive.</p><p>Here’s another way you might think to refactor the previous if (condition) { //do something } without the when directive by using the &amp;&amp; operator :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e61e860e9b49680d8e2f3b1290dc5d93/href">https://medium.com/media/e61e860e9b49680d8e2f3b1290dc5d93/href</a></iframe><p>This is also a valid and aesthetically pleasing implementation. Let’s run a benchmark to compare this with the when directive implementation :</p><p><em>local version — </em>represents &amp;&amp;<br><em>master version — </em>represents when directive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W1AjBtZvuR0lsRLQM_hsBA.png" /></figure><p>To summarize the results:</p><ol><li>The blue boxes indicate that between the 2 implementations, there was <strong>no</strong> statistical performance difference in <em>javascript execution time</em> and <em>memory consumption</em>.</li><li>The green boxes show that if (condition) { //do something } bundle size turns out to be <strong>more than</strong> — <em>129.82kb </em>compared to the<em> 129.80kb — </em>when directive</li></ol><p>Surprise, surprise! when directive is still the winner here in terms of bundle size. When you want to render a template based on a single condition, this nifty when directive is your go-to.</p><blockquote>Given these results, the guidance here is to use the <em>when directive</em> to reduce overall bundle size (every byte counts!).</blockquote><h4>Bad use case 1</h4><p>While the when directive comes in handy in the previous scenarios; it does not provide optimizations in every scenario.</p><p>For example, just as you would not do something like this in your code:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/94f68e34bb6da5a00ab589cb55e48064/href">https://medium.com/media/94f68e34bb6da5a00ab589cb55e48064/href</a></iframe><p>You should not do this with the when directive:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4099de967b758f982e5f921ce8dd6454/href">https://medium.com/media/4099de967b758f982e5f921ce8dd6454/href</a></iframe><p>Let’s expand both these implementations and see how they look in the bigger picture, starting with the when directive:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0e3b6f4f27128fa1d0ec3377355fc462/href">https://medium.com/media/0e3b6f4f27128fa1d0ec3377355fc462/href</a></iframe><p>While there are no errors in this implementation, I hope you can see that this can quickly become unmanageable if more conditions are added. Additionally, by separating the two lines of when directive code, it may make it seem like the 2 conditions are not related. This is just an if...else statement, so we should write it as one.</p><p>Here’s one way to refactor this with the ternary operator, and eliminating the when directive.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/93db008ac98551a6f067bb4c884e379e/href">https://medium.com/media/93db008ac98551a6f067bb4c884e379e/href</a></iframe><p>This is arguably more readable than the previous when directive example. Here are the benchmark results between the <em>when_long_example.ts </em>and <em>if_long_example.ts:</em></p><p><em>NOTE: For this particular benchmark, the click event handler on the button is triggered 10x for each sample taken to switch between templates.</em></p><p><em>local version — </em>represents ternary operator<br><em>master version — </em>represents when directive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KfutZkg3BsJfIpBDrKJg8A.png" /></figure><p>To summarize the results:</p><ol><li>The blue boxes indicate that between the 2 implementations, there was <strong>no</strong> statistical performance difference in <em>javascript execution time</em> and <em>memory consumption</em>.</li><li>The green boxes show that ternary operator bundle size turns out to be <strong>less than</strong> — <em>130.82kb </em>compared to the<em> 130.88kb — </em>when directive</li></ol><blockquote>Given these results, the guidance here is to use the ternary operator to reduce overall bundle size (every byte counts!).</blockquote><p>Up to this point, you should get the idea that when directive is valuable as a replacement for if (condition) { //do something }. Outside of this scenario, it is not recommended when working with conditionals or dynamic templates.</p><h4>Bad use case 2</h4><p>Let’s look at some more examples to illustrate common misusage of the when directive. Here’s how you might use the when directive to handle templates that change depending on a series of conditions:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d01a761a54685811895a52d62245f0a/href">https://medium.com/media/1d01a761a54685811895a52d62245f0a/href</a></iframe><p>If you aren’t careful, you could easily make the error of displaying multiple templates at the same time with the when directive(I made this mistake while drawing up this example).</p><p>Let’s summarize what we’re trying to achieve and think about a more effective implementation. Depending on what the <em>emotionalLevel </em>value is, we want to render the corresponding template:</p><p>0–1 depressed <br>2–3 sad<br>4–5 indifferent<br>6–8 happy<br>9–10 ecstatic</p><p>With a switch statement you can define the numbers in a specific range, but with the when directive you’d have to be more explicit. Check out the example below using the switch statement:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6f16e2b08215cd84bee8dc4bf520df7a/href">https://medium.com/media/6f16e2b08215cd84bee8dc4bf520df7a/href</a></iframe><p>This implementation is less error-prone and gives better context on how the <em>emotionLevel</em> relates to each of the templates.</p><p>Let’s do a quick sanity check with a benchmark run:</p><p><em>NOTE: For this particular benchmark, the click event handler on the button is being triggered 10x for each sample taken to switch between templates. The emotionLevel is incremented from 0–10.</em></p><p><em>local version — </em>represents switch statement<br><em>master version — </em>represents when directive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLybuP8OtPeQsdYMmqecRg.png" /></figure><p>To summarize the results:</p><ol><li>The blue boxes indicate that between the 2 implementations:<br>A. There was <strong>no</strong> statistical performance difference in <em>javascript execution time</em>.<br>B. <em>Memory consumption</em> was <strong>faster</strong> with the switch statement compared to the when directive</li><li>The green boxes show that switch statement bundle size turns out to be <strong>less than</strong> — <em>130.94kb </em>compared to the<em> 131.01kb — </em>when directive</li></ol><blockquote>Given these results, the guidance here is to use the switch statement to reduce overall bundle size (every byte counts!) AND memory optimization.</blockquote><p>The fun does not have to stop here, you can keep thinking of cleaner ways to refactor your code where it makes sense. For example, if you prefer your template to be less cluttered, you can move the switch statement into its own method and use a map to find the template that matches the condition.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/874543cccc8f9cc486accccc8d5f88ef/href">https://medium.com/media/874543cccc8f9cc486accccc8d5f88ef/href</a></iframe><p>This would undoubtedly result in more code, and running a benchmark confirms that bundle size increases. See below:</p><p><em>NOTE: For this particular benchmark, the click event handler on the button is being triggered 10x for each sample taken to switch between templates. The emotionLevel is incremented from 0–10.</em></p><p><em>local version — </em>represents map<br><em>master version — </em>represents when directive</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLybuP8OtPeQsdYMmqecRg.png" /></figure><p>To summarize the results:</p><ol><li>The blue boxes indicate that between the 2 implementations:<br>A. There was <strong>no</strong> statistical performance difference in <em>javascript execution time</em>.<br>B. <em>Memory consumption</em> was faster with the map solution compared to the when directive</li><li>The green boxes show that map bundle size turns out to be <strong>more than</strong> — <em>131.25kb </em>compared to the<em> 131.01kb — </em>when directive</li></ol><blockquote>Given these results, the guidance here is to still use the <em>switch statement</em> in the template over the map<em> </em>and<em> </em>when directive solutions if you want both the benefit of smaller bundle size and memory optimization.</blockquote><p>While this may not be the most optimized implementation for this particular scenario, if your switch statements become longer, the results could quickly shift to favor the map solution. It’s important to be able to adapt to different scenarios.</p><p>In summary, when you are simply working with a single if statement in your template, you should be using the when directive. On the other hand, when you have more complex conditional situations, it is better to omit the use of the when directive !</p><p>Performance results can fluctuate depending on how complex your conditionals or templates become. If you keep this in mind, you can continue to improve the codebase you are working on.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e26ce7637ba" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/when-to-use-when-6e26ce7637ba">When to use when?</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Evolution of design tokens and component styling, part 1]]></title>
            <link>https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/f1491ad1120e</guid>
            <category><![CDATA[design-to-code]]></category>
            <category><![CDATA[design-systems]]></category>
            <dc:creator><![CDATA[Brian Heston]]></dc:creator>
            <pubDate>Mon, 08 Aug 2022 17:17:19 GMT</pubDate>
            <atom:updated>2022-10-05T20:30:18.585Z</atom:updated>
            <content:encoded><![CDATA[<p>Here is a look at the state of design tokens in the industry, how they currently manifest in FAST (<a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-2-1018e8bae62">part 2</a>), and how that might evolve for improved and unified support in the future (part 3 coming soon).</p><h3>Design tokens in the industry</h3><p>Defined generally, “design tokens” are quickly becoming the industry-wide method to organize and build design values into interface components. Unfortunately, there are currently many implementations, tools, and formats in use across different authors or technologies, but with the release of the <a href="https://tr.designtokens.org/format/">W3C Design Tokens Community Group Draft Report</a>, we can hopefully start to converge on at least a few key aspects.</p><p><em>This is a community group, and the output is more of a recommendation than an official platform spec. This article will refer to this as the “format”, “recommendation”, or “recommended format”.</em></p><h3>Benefits</h3><p>Here are a few of the positive impacts of design tokens in general, and their increasing coherence through industry alignment.</p><h4>Centralize definitions</h4><figure><img alt="Arrows pointing to a central representation of design tokens" src="https://cdn-images-1.medium.com/max/740/1*dQGe9ZAvQnYr6VDxB4G9Bg.png" /></figure><p>At the most basic level, design tokens exist to externalize design values to a central location that can be referenced broadly. Because they’re central, they can be modified for a given use case and will apply consistently. For example, a component framework can be implemented to reference a “<strong>brand-color</strong>” token instead of hard-coding the same color everywhere.</p><figure><img alt="A button and checkbox, each referencing a “brand-color” token, with representation of the value changing from blue to green" src="https://cdn-images-1.medium.com/max/888/1*mJtQlZm-NxjILb3ztljL8A.png" /></figure><p>Now we can simply change the <strong>value</strong> associated with the <strong>token</strong>, and the <strong>components</strong> follow.</p><p><em>Note the arrows all point to the left, which is an important distinction we’ll look at in “Design to code” in part 3. This flow indicates each specific use is referencing a known and expected less-specific definition.</em></p><h4>Intended for interop</h4><figure><img alt="Illustration of a desktop, tablet, and phone" src="https://cdn-images-1.medium.com/max/740/1*TvnUHU1mfHfCexo1J4AwsA.png" /></figure><p>Centralized definition is what CSS preprocessors like SASS or LESS brought us, but the intent of design tokens is to be agnostic to the technology to increase interoperability. That is, the same token definitions could be used across Android, iOS, XAML, or various web frameworks. To achieve this, the recommendation defines JSON as the definition format.</p><figure><img alt="Diagram showing JSON tokens in the middle, pointing out to Android, iOS, Web, and XAML consumers" src="https://cdn-images-1.medium.com/max/864/1*sKTw4k3cBWWEG1vf7kIsOA.png" /></figure><h4>Translatable</h4><figure><img alt="Illustration of design tokens being processed through a gear producing multiple output files" src="https://cdn-images-1.medium.com/max/740/1*U6OwhI3XbJS_icoJkg9sCA.png" /></figure><p>A common format is important, but the chosen JSON format is not natively rendered by presentation technologies. The way to handle this is through translation tooling, of which there are several options. <a href="https://amzn.github.io/style-dictionary/">Amazon’s Style Dictionary</a> is very flexible, regularly maintained, and has many references across the industry. <a href="https://github.com/salesforce-ux/theo">Salesforce’s Theo</a> and <a href="https://diez.org">Diez</a> haven’t been updated in a couple of years, though they may still be viable for some uses. There’s also <a href="https://specifyapp.com">Specify</a>, which is marketed as a “Design data platform” service, which seems promising but less open than other solutions. AdobeXD has also defined a <a href="https://github.com/AdobeXD/design-system-package-dsp">Design System Package</a> format. All these tools fit somewhere between the design definition and implementation.</p><p><em>Note that all tools may not support the recommended format at this time.</em></p><figure><img alt="Illustration of json design tokens being processed through specific tools, producing examples of a token in the different consumer formats for Android, iOS, Web, and XAML" src="https://cdn-images-1.medium.com/max/1024/1*x-cTNAebl5G_AVm5lCk32g.png" /></figure><h3>Current concerns</h3><p>Even with the options available today, there are many gaps to fill and misuses to resolve.</p><h4>No standard for naming</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*0yrAslt2l1d0hkrkLZMu2w.png" /></figure><p>Following the many implementations, formats, and tools mentioned above, there is also no standard around the structure or naming of design tokens. This means that even as a common format gains support, there are no agreements in sight that will enable interoperability across design systems or component frameworks.</p><p>For example, here are the tokens for two popular design systems representing the brand color:</p><ul><li>Google Material Design 3: <strong>md.sys.color.primary</strong> (md=Material Design, sys=System)</li><li>Salesforce Lightning: <strong>colorBrand</strong> or <strong>brand-primary</strong> (they have two sets?)</li></ul><p>Given that there is often a need to mix and match component libraries, having no consistent way to apply design values poses some challenges. For example, consider combining two complicated components like a calendar from one library and a shopping cart from another. You would need to configure each component’s specific design tokens to coordinate the brand color, among any other attributes you might want to unify.</p><p>For a simpler case, there’s really no reason for many component frameworks to build yet another Button, but they will if that’s the only way to apply their design tokens.</p><h4>No standard for applying tokens</h4><figure><img alt="Illustration of a design token pointing to a button, checkbox, and radio, with question marks" src="https://cdn-images-1.medium.com/max/740/1*7w5fewXedXTwVf_gBIMV4Q.png" /></figure><p>There are also no standards for how to apply tokens to components. For example, every component framework I can think of has a brand-colored Button, but there’s no universal way to connect the “<strong>brand-color</strong>” token (or whatever it’s called) to the Button’s fill.</p><p>The work happening under <a href="https://open-ui.org/components/button">Open UI</a> could provide some necessary portion of a solution to this. This project seeks to define a base anatomy for common components. For example, a Button has “<strong>content</strong>” and “<strong>root</strong>” parts. The “<strong>root</strong>” represents the main visual container of the Button, which is where the fill color is applied for this component. A reasonable representation of addressing this is “<strong>button.root.fill</strong>”.</p><p><em>The “Design to code” proposal in part 3 seeks to bridge design token definitions with UI implementations in a way that any components which support declarative anatomy can take advantage of declarative styling.</em></p><h4>Not tracking the underlying decisions</h4><figure><img alt="Illustration of design decisions, picking rest, hover, and press state colors from a light to dark ramp and “4.5:1” and “3:1” indicating contrast requirements" src="https://cdn-images-1.medium.com/max/740/1*nF6l2EuHM5gjKwnNwsVMbQ.png" /></figure><p>The point of a design “system” is that many individual decisions come together for a cohesive outcome. Design tokens work well for defining specific values, but the underlying decision that produces a specific value is lost or not applied consistently. A great example of this is often seen in color choices for interactive components like Buttons or between light and dark modes.</p><p>Looking back to the brand color Button scenario, here are the “<strong>brand</strong>” rest and hover colors Salesforce defines as tokens:</p><figure><img alt="Sample blue buttons in rest and hover state using different shades for the background. Rest and hover both have light text." src="https://cdn-images-1.medium.com/max/450/1*z4C1dyjX5TzGl7v1jQ-k-Q.png" /></figure><p>These colors are “<strong>blue-50</strong>” and “<strong>blue-30</strong>” respectively.</p><p>Here are the rest and hover colors for a “<strong>success</strong>” Button:</p><figure><img alt="Sample green buttons in rest and hover state using different shades for the background. Rest has dark text and hover has light text." src="https://cdn-images-1.medium.com/max/450/1*GnWUYGdnDnteBJYWW3zuBQ.png" /></figure><p>These colors are “<strong>green-70</strong>” and “<strong>green-50</strong>”. The colors are still offset two spaces on the palette, but lighter, such that the success button requires flipping the text to meet contrast. Without context, this feels like an odd choice and there doesn’t seem to be a clear rule as to the selection of the “<strong>success</strong>” colors relative to “<strong>brand</strong>”.</p><p>Let’s look at one more example, for Salesforce’s “<strong>destructive</strong>” button:</p><figure><img alt="Sample red buttons in rest and hover state using different shades for the background. Rest and hover both have light text." src="https://cdn-images-1.medium.com/max/450/1*5gJZwrxN494nxHIPo4NaxA.png" /></figure><p>Here they are “<strong>red-40</strong>” and “<strong>red-30</strong>”. No consistent pattern between where the colors sit on the palette or how much space is between them.</p><p>If a designer needed an orange button for a warning, what rule should they use to select the colors from the palette? There’s no way to know because the decisions that went into these examples aren’t described in the flow of the token references.</p><h4>Potential to make individual changes that break downstream</h4><figure><img alt="Illustration of a design token, referenced by two other design tokens, one going to a button and the other to a radio button. The top design token is edited, the button is happy, but the radio is sad." src="https://cdn-images-1.medium.com/max/740/1*tNYb_nsSMT0XjIWYezp7Bw.png" /></figure><p>This gap builds upon the previous point about not tracking underlying decisions.</p><p>Every major design token implementation relies on aliasing or referencing “base” or “global” tokens to increase specificity of use. For example, the “<strong>background-success</strong>” color used for the rest state of the button above references “<strong>green-70</strong>”, which is assigned the actual fixed color value.</p><p>A designer needs to style a “<strong>success</strong>” slider and uses “<strong>background-success</strong>” for the fill. They realize that for a slider to be accessible it must meet 3:1 contrast with the container. The app background color of #f3f3f3 requires “<strong>green-50</strong>” to meet contrast so they change “<strong>background-success</strong>” from “<strong>green-70</strong>” to “<strong>green-50</strong>”.</p><figure><img alt="Illustration of failing contrast on a slider, a common design token value being updated, then breaking contrast on a button." src="https://cdn-images-1.medium.com/max/1024/1*JXbOSg71z9nuh7hnFY0fmw.png" /></figure><p>Because the Button also references “<strong>background-success</strong>”, it now uses “<strong>green-50</strong>” for both the rest and hover state, which is unexpected, and worse yet the Button foreground color is no longer accessible. Because the “success” Button wasn’t used in this part of the experience, the designer didn’t notice it was broken.</p><p>There may be additional layers of aliases, which introduces more potential for unexpected changes.</p><p>Obviously, designers need to be very careful when changing underlying tokens, but this is a common pain point and tradeoff. Either you update the value to “fix” the system, or you deviate and create yet another intermediate token, which must then be tracked, understood, and used correctly.</p><h4>No inherent support for theming</h4><figure><img alt="Illustration of a split rectangle with a sun over light and a moon over dark." src="https://cdn-images-1.medium.com/max/740/1*P6vO4_NuAhVd8KSNgmlkCQ.png" /></figure><p>Customers are expecting more from the visual design of their experiences. At a minimum, they expect dark mode in addition to the historically default light mode. Many also rely upon accessibility features, including the ability to request increased contrast or reduced motion. These features are not commonly supported across the web currently, but the fact that they are built into the web platform means it’s time for experiences built for browsers to catch up.</p><p>Most design token systems don’t have a concept to support theming other than to completely override all token values. This is feasible for building a dark mode, but is a manual process which must be kept in sync with the base set of tokens or the light mode tokens it overrides. All colors must also meet contrast requirements. This approach is time-consuming, error-prone, and doesn’t scale to support true customization and personalization.</p><h4>Using t-shirt sizes to express options</h4><figure><img alt="Illustration of small, medium, and large t-shirts." src="https://cdn-images-1.medium.com/max/740/1*VejDXK65SnBKhdwcrldXMQ.png" /></figure><p>Design tokens that represent a ramp of choices, like for spacing, border radius, and font size, are often expressed using t-shirt sizes like small, medium, and large. While the sequence is well known, it can break down in actual use and inevitable extension or modification in the future. For example, here are Material Design’s latest shape tokens:</p><figure><img alt="Material Design’s shape scale from “no rounding” to “full”." src="https://cdn-images-1.medium.com/max/936/1*BB3XUY855weX1VbvukJZSg.png" /></figure><figure><img alt="Material Design shape values." src="https://cdn-images-1.medium.com/max/937/1*geFBPaGu5nFXyB88YYbGWA.png" /></figure><p>One issue is the size token names impart meaning that doesn’t exist. For instance, “<strong>medium</strong>” happens to be in the middle, but it’s not the most commonly used, and by default applies only to a Card. Compare that to Lightning design where “<strong>medium</strong>” is only 4px and used as the default for many controls like Button and Text Inputs.</p><p>Another issue arises when additional sizes are needed. Ideally in a true “system” we can avoid this, but a token structure needs to support design without getting in the way. We can add on, like “<strong>extra-extra-large</strong>” or in between like “<strong>small-medium</strong>”, but this can get messy quickly.</p><h4>Leads to copies of complicated CSS</h4><figure><img alt="Illustration of a checkbox, button, and radio referencing identical CSS files." src="https://cdn-images-1.medium.com/max/740/1*ofAFsVp4pWjc0v7JdHluEw.png" /></figure><p>Styling components is complicated. There are many CSS attributes that must be applied, and CSS is finicky enough that if this isn’t done consistently you will get different results.</p><p>Consider a Button. It will at least have attributes for the “<strong>content</strong>” font and color, and the “<strong>root</strong>” background color. It will likely be stateful, so multiply this by “<strong>rest</strong>”, “<strong>hover</strong>”, “<strong>active</strong>”, “<strong>focus</strong>”, and “<strong>disabled</strong>”. It may also have a border with color, thickness, radius, and a dash pattern. It could have a drop shadow for elevation, some animation timing, some layout settings, it may be selected, and the list goes on.</p><p>Consider just one portion of that example, applying a background color for rest, hover, and active states. That’s three CSS selectors and three tokens, one for each. Then you go to test it and realize that even a Button in “<strong>disabled</strong>” state is responding to the “<strong>hover</strong>” state. That selector needs to apply only when the component is enabled. Then you realize the hover state isn’t responding correctly on a touch device. That selector also needs a media query.</p><p>Now you have to repeat that for every other component that may respond to hover and active states, may be disabled, may be used with touch, etc. And that’s only one example. Tokens are good for providing the values, but they’re not enough to make sure they are applied correctly and consistently.</p><p>Make sure to follow FAST for <a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-2-1018e8bae62">part 2</a> and part 3 (coming soon) that look at what we can do to solve this in a creative and flexible way.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1491ad1120e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/evolution-of-design-tokens-and-component-styling-part-1-f1491ad1120e">Evolution of design tokens and component styling, part 1</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in the Microsoft Fluent UI library for Blazor version 1.5]]></title>
            <link>https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-1-5-802bece0e97a?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/802bece0e97a</guid>
            <category><![CDATA[fluent-ui]]></category>
            <category><![CDATA[blazor]]></category>
            <dc:creator><![CDATA[Vincent Baaij]]></dc:creator>
            <pubDate>Mon, 01 Aug 2022 14:05:15 GMT</pubDate>
            <atom:updated>2022-08-01T14:05:15.277Z</atom:updated>
            <content:encoded><![CDATA[<p>We have a nice set of changes and additions for this summer edition of the <a href="https://www.nuget.org/packages/Microsoft.Fast.Components.FluentUI">Fluent UI component library for Blazor</a>. Not just new components, but also support for more event handling, support for more bindings, new and updated icons, and changes in the demo environment. Here is everything we added or changed in version 1.5:</p><ul><li>New component: &lt;FluentSearch&gt;</li><li>New component: &lt;FluentCalendar&gt;</li><li>New and updated icons</li></ul><p>And some more ‘under the hood’ changes:</p><ul><li>Added an example showing inheriting to bind to theoninput event</li><li>Changed enum names to match Web Components names</li><li>Used FluentIcon instead of SVGs in example pages</li><li>Added support for more event handling</li><li>Added support for more bindings</li><li>Other changes</li></ul><h3>New component: &lt;FluentSearch&gt;</h3><p>A new addition to the Fluent UI Web Components is the FluentSearchcomponent (<a href="https://fluent-components.azurewebsites.net/?path=/docs/components-search--search">example here)</a>. Of course we’ve brought this over to the Blazor component set as well. It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/0*p6aq42kkF8i_h8Wz.png" /></figure><h3>New component: &lt;FluentCalendar&gt;</h3><p>Another addition to the Web Components is the FluentCalendar component (<a href="https://fluent-components.azurewebsites.net/?path=/docs/components-calendar--calendar">example here)</a>. It has been added to the Blazor set and will, in the future, be used as part of a date picker component. It looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/0*sBmFSUJhHL56M0gh.png" /></figure><p><strong>Note: </strong>At the moment there is still a bug in the display of the calendar when the week has a start day other than Sunday (as can be seen above). This will be fixed in a later update.</p><p><em>The changes and additions described below are a bit more low-level and more for developers than for end-users of the library.</em></p><h3>New and updated icons</h3><p>The &lt;FluentIcon&gt; component uses the <a href="https://github.com/microsoft/fluentui-system-icons">Fluent UI System Icons</a> collection. We have updated and imported all the icons from version 1.1.176.</p><h3>Example of inheriting to bind to oninput event</h3><p>All the Input related components, like FluentTextField, FluentTextArea and FluentNumberField are set up to do binding on the onchange event. In most situations this is fine but sometimes you might need a binding to occur within an oninput event. This is possible by inheriting the component in question and changing/adding some of the parameters in the .razor file. An example of this is now provided in the FluentNumberFieldOnInput.razor file in the examples/FluentUI.Demo.Shared/Shared/ folder.</p><h3>Change enum names to match Web Components</h3><p>There have been some massive improvements to the <a href="https://www.fast.design/docs/category/components">FAST documentation</a>. This makes a lot of information much more discoverable. Because of this we wanted to make some changes on the Blazor side as well so we have re-implemented most of the enum types. Initially we added these with very generic names like Direction and Orientation. Based on these new docs, we concluded that these should have names much more related to the components they are being used in (i.e. FlipperDirection and TabsOrientation). We have updated all the enumerations concerned and marked all the old ones as obsolete. These &#39;wrong&#39; enums will be removed in a later version of the library.</p><h3>Use FluentIcon instead of SVGs in example pages</h3><p>A lot of the examples in the demo sites were still using plain inline SVGs when showing an icon. These have all been changed to use the (recently introduced) &lt;FluentIcon&gt; component.</p><h3>Support for more event handling</h3><p>The new docs also showed that there are events available on components which we were not yet handling on the Blazor side. Examples of these are change events on the Accordion and Tabs components. The complete list of Blazor components with new event handling are:</p><figure><img alt="Table that shows the different new event handlers" src="https://cdn-images-1.medium.com/max/676/1*sao3vWGqeuvL6wWZz3TFig.png" /></figure><p>All of the ...EventArgs above, besides the HorizontalScrollEventArgs, are coded in a way that they contain the actual affected component as a parameter. This means you can call any method or work with any parameter the component supports in the event handling code.</p><p>Here’s an example of this kind of event handling:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9252be3760b3a07fa0b9ad722aed47c5/href">https://medium.com/media/9252be3760b3a07fa0b9ad722aed47c5/href</a></iframe><p>More examples of event handling can be found in the Pages folder under examples/FluentUI.Demo.Shared/ folder</p><h3>Support for more bindings</h3><p>We have also added support for some more bindings:</p><ul><li>&lt;FluentTabs&gt; : Bind the ActiveId parameter to the id of the active tab</li><li>&lt;FluentTreeView&gt; : Bind the CurrentSelected parameter to the currently selected tree item</li><li>&lt;FluentCalendar&gt; : Bind the SelectedDates parameter to the List&lt;DateOnly&gt; of selected dates</li><li>&lt;FluentAccordion&gt;* : Bind the ActiveId parameter to the id of the active accordion item</li></ul><p>*= not fully implemented yet. We are waiting for the necessary changes in the underlying web components implementation.</p><p>Here’s an example of a binding with the FluentCalendar component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/468af7e4dcddcf00b37ac8bde76410ba/href">https://medium.com/media/468af7e4dcddcf00b37ac8bde76410ba/href</a></iframe><p>More examples of the bindings can be found in the Pages folder under examples/FluentUI.Demo.Shared/ folder.</p><h3>Other changes</h3><p>Some other (smaller) changes we have made to the library are:</p><ul><li>Added Disabled and Text parameters to &lt;FluentTab&gt;</li><li>Added Heading parameter to &lt;FluentAccordionItem&gt;</li><li>AddedTextparameter to &lt;FluentTreeItem&gt;</li><li>Fixed working the ActiveIndicator parameter on &lt;FluentTabs&gt;</li><li>Added DisabledSelectable parameter to &lt;FluentCalendar&gt; (defaults to true)</li><li>Added OutOfMonthSelectable parameter to &lt;FluentCalendar&gt; (defaults to true)</li></ul><h3>What’s next?</h3><p>We are already thinking about what we could add, change and update in the next couple of releases. Please chime in with your own ideas on our <a href="https://github.com/microsoft/fast-blazor/discussions">GitHub Discussions</a> or <a href="https://discord.com/channels/449251231706251264/744625301040005121">Discord channel</a>. For sure, a (major) new release will arrive after we have updated our Blazor wrappers to the upcoming Fluent UI Web Components v3 release (no firm dates yet). We are also hard at work on improving the documentation. We are going through each and every component and if we find things like parameters or events that are present in the Web Components or underlying FAST Foundation but missing on the Blazor side, we will add them of course. This will most likely be done with minor version releases like 1.5.1, 1.5.2, etc. We will continue to keep you up to date as these versions ship.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=802bece0e97a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-version-1-5-802bece0e97a">What’s new in the Microsoft Fluent UI library for Blazor version 1.5</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FAST Web Components on 20minJS]]></title>
            <link>https://medium.com/fast-design/fast-web-components-on-20minjs-e7b041ec1c43?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/e7b041ec1c43</guid>
            <category><![CDATA[podcast]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[EisenbergEffect]]></dc:creator>
            <pubDate>Tue, 19 Jul 2022 13:17:26 GMT</pubDate>
            <atom:updated>2022-07-19T13:17:26.172Z</atom:updated>
            <content:encoded><![CDATA[<p>Recently <a href="https://github.com/chrisdholt">Chris Holt</a> and <a href="https://github.com/eisenbergeffect">Rob Eisenberg</a> from the FAST team had the opportunity to discuss Web Components with <a href="https://www.linkedin.com/in/fernandodoglio/">Fernando Doglio</a> on <a href="https://podcast.20minjs.com/">the 20minJS podcast</a>.</p><p>The discussion covered so much content that it needed to be split into two episodes:</p><ul><li><a href="https://podcast.20minjs.com/1952066/10744129-episode-14-web-components-with-chris-holt-and-rob-eisenberg">Part 1: Episode 14 — Web Components with Chris Holt and Rob Eisenberg</a></li><li><a href="https://podcast.20minjs.com/1952066/10783154-episode-15-web-components-part-2-with-chris-holt-and-rob-eisenberg">Part 2: Episode 15 — Web Components with Chris Holt and Rob Eisenberg</a></li></ul><p>We hope you enjoy listening to the conversation 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7b041ec1c43" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/fast-web-components-on-20minjs-e7b041ec1c43">FAST Web Components on 20minJS</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimize list rendering with repeat’s view recycling feature]]></title>
            <link>https://medium.com/fast-design/optimize-list-rendering-with-repeats-view-recycling-feature-c5210bd087dd?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/c5210bd087dd</guid>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[benchmarking]]></category>
            <dc:creator><![CDATA[Wendy Hsu]]></dc:creator>
            <pubDate>Mon, 27 Jun 2022 12:54:48 GMT</pubDate>
            <atom:updated>2022-06-27T12:54:48.225Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8exGoeca_R0dR-4ibuSsJA.jpeg" /><figcaption>Woman turning the wheel</figcaption></figure><p>One of the most ubiquitous array operations is iteration. The <strong><em>repeat</em></strong> directive in @microsoft/fast-element makes the process of iterating and rendering lists a seamless experience. If you are unfamiliar with this, take a quick read here: <a href="https://www.fast.design/docs/fast-element/using-directives/#the-repeat-directive">Using Directives | FAST</a>.</p><p>While the <strong><em>repeat</em></strong> directive already provides robust out-of-the-box performance optimizations, you can take this further by understanding how and when to use the repeat options parameter. In this article, we are going to take a look at the <strong><em>recycle</em> </strong>property<em>.</em></p><h3>What does recycle do?</h3><p>By default, <strong><em>recycle</em> </strong>is set to true. This setting means that the repeat directive will reuse views instead of creating new ones from the template whenever possible.</p><p>Here’s a basic example of using <strong><em>repeat </em></strong>in a template:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a010c33f66c277f86f615c17365457f2/href">https://medium.com/media/a010c33f66c277f86f615c17365457f2/href</a></iframe><p>Let’s say this is our initial friends list: [“London&quot;, “Austin&quot;, “Chris&quot;] .</p><p>Running the above code will iterate through the friends list and list each friend by name. Under the hood, a new view will be created for each item. Simple enough.</p><p>Now, I’ve decided I want some new friends, so I replace the friends list with: [“Fernando&quot;, “Satoshi&quot;, “Mi&quot;].</p><p>You can see that structurally, nothing much has changed: the template stays the same, and the friends list is still an Array with three items.</p><p>The only thing that changed here is the data, which is where the beauty of recycling views comes in. <strong><em>repeat</em></strong> will find the existing view from the template and replace only the data: &quot;London&quot; will be replaced with &quot;Fernando&quot;, and so on.</p><h4>Benchmark results between {recycle: true} and {recycle: false}</h4><p>Let’s run some benchmarks to compare what happens when <strong><em>recycle </em></strong>is turned off. For context, the following benchmarks are run with <a href="https://github.com/microsoft/fast/tree/master/packages/utilities/fast-benchmarks">fast-benchmarks</a> with a sample size of 30.</p><p><strong>.reverse()</strong></p><ul><li>1000 items in array [itemCount]</li><li>.reverse() is run 100 times for each run [loopCount]</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLuzsZdO2dGZFYWBPTiDcw.png" /><figcaption>Javascript execution time between {recycle: true} and {recycle: false} on a basic template.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bR_iUSvIR3dhJ_1bBuLpig.png" /><figcaption>Memory consumption between {recycle: true} and {recycle: false} on a basic template. *ms units reported under ‘Avg time’ are meant to be mb</figcaption></figure><p>In basic templates like the example above, it is more performant to recycle views — different variations of <em>itemCount</em> and <em>loopCount</em> report similar results.</p><p>Well, that’s convenient! Why would you ever want to turn off the <strong><em>recycle</em> </strong>option? That leads us to the next topic.</p><h3>When to turn off the recycle option?</h3><p>When your data starts becoming more complex, there is a threshold of when recycling views becomes more cumbersome than creating new views from scratch.</p><p>Here is an example of a template that uses some nested repeat directives:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc1ad810cc4fae8fb1c60d550258e7de/href">https://medium.com/media/cc1ad810cc4fae8fb1c60d550258e7de/href</a></iframe><h4>Benchmark results between {recycle: true} and {recycle: false} with a nested template</h4><p>Things start to get interesting when comparing results between {recycle:true} and {recycle: false}.</p><p><strong>.splice()</strong></p><ul><li>50 items in array [itemCount]</li><li>.splice(i, deleteCount = 10, …generateData(addCount=10)) is run 5 times for each run [loopCount]</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*dT6AuHReI5FHQWenidYzdQ.png" /><figcaption>Javascript execution time between {recycle: true} and {recycle: false} on a basic template.</figcaption></figure><p>Wait, the version with <strong><em>recycle</em></strong> turned on no longer shows that it is faster than <strong><em>recycle</em></strong> turned off. Take a look at the following screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*gaHBr6bfNJVDurzphBJPTw.png" /><figcaption>Memory consumption between {recycle: true} and {recycle: false} on a nested template. *ms units reported under ‘Avg time’ are meant to be mb</figcaption></figure><p>The memory consumption is more performant when <strong><em>recycle</em></strong> is turned off in a nested template. This outcome makes sense logically. If you think about it, it will probably take <em>more</em> memory to locate a nested item and switch out the data than simply creating a new one. This situation is where the value of turning off the <strong><em>recycle</em></strong> property comes into play.</p><h3>How to turn off the recycle option?</h3><p>Turning off the <strong><em>recycle</em></strong> property is as easy as setting the options at the end of your <strong><em>repeat</em></strong> block.</p><p>Let us reiterate our findings from the benchmarks we ran; when we have a template with nested repeat directives, it is more performant to set the <strong><em>recycle</em></strong> option to false.</p><p>Here’s an example of how you can set that on the template with nested <strong><em>repeat</em></strong> directives:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/cbd418d6ad8b3c9cf2ba1d3b6236c6cd/href">https://medium.com/media/cbd418d6ad8b3c9cf2ba1d3b6236c6cd/href</a></iframe><p>Make sure you define {recycle: false} within the repeat block, right after you define your template.</p><p>Here’s the same example with the template extracted from the repeat block:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/67a5db62570a3beaf1059b951180f6b9/href">https://medium.com/media/67a5db62570a3beaf1059b951180f6b9/href</a></iframe><p>Understanding how to use the features of the <strong><em>repeat</em></strong><em> </em>options will help you think in a data-driven way and give you significant performance gains.</p><p>Learn more about <strong><em>repeat</em></strong> and other directives in our documentation on <a href="https://www.fast.design/docs/fast-element/using-directives">Using Directives | FAST</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c5210bd087dd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/optimize-list-rendering-with-repeats-view-recycling-feature-c5210bd087dd">Optimize list rendering with repeat’s view recycling feature</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s new in the Microsoft Fluent UI library for Blazor versions 1.3 and 1.4]]></title>
            <link>https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-versions-1-3-and-1-4-4c3ea55a4b56?source=rss----18962b425c12---4</link>
            <guid isPermaLink="false">https://medium.com/p/4c3ea55a4b56</guid>
            <category><![CDATA[fluent-ui]]></category>
            <category><![CDATA[net6]]></category>
            <category><![CDATA[blazor]]></category>
            <dc:creator><![CDATA[Vincent Baaij]]></dc:creator>
            <pubDate>Fri, 10 Jun 2022 17:47:11 GMT</pubDate>
            <atom:updated>2022-06-12T20:19:24.580Z</atom:updated>
            <content:encoded><![CDATA[<p>The <a href="https://www.fast.design/">FAST</a> team and friends have been hard at work not only on <a href="https://github.com/microsoft/fast/">Microsoft’s core Web Components platform</a>, but also on <a href="https://github.com/microsoft/fast-blazor">Fluent UI integrations for Blazor</a>. This post will give you an overview of what’s new and changed in versions 1.3 and 1.4 of <a href="https://www.nuget.org/packages/Microsoft.Fast.Components.FluentUI/">the Microsoft Fluent UI Blazor library</a>.</p><p>In short, the two big end-user additions (besides some bug fixes) are:</p><ul><li><a href="https://github.com/microsoft/fluentui-system-icons#fluent-ui-system-icons">Fluent UI System Icons</a> support</li><li>Design Token support</li></ul><p>And repository and code changes:</p><ul><li>Add missing xml comments</li><li>Add FocusAsync methods to FluentInputBase</li></ul><h3>Fluent UI System Icons support</h3><p>The <a href="https://github.com/microsoft/fluentui-system-icons#fluent-ui-system-icons">Fluent UI System Icons</a> are a (still growing) collection of familiar, friendly, and modern icons from Microsoft. Currently, more than 2020 distinct icons are available in various sizes of filled and outlined versions. The collections consist of well over 11k icons in SVG format. All of them have been added to the library in an easy-to-use way by adding the &lt;FluentIcon&gt; component. Just putting this in your .razor page:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e886a55a2220773807213a9eb4978b55/href">https://medium.com/media/e886a55a2220773807213a9eb4978b55/href</a></iframe><p>Will give you this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/50/1*NZ281bjwfzziuc9XI_F8Rg.png" /><figcaption>Accessibility icon in the accent color</figcaption></figure><p>A couple of things to unwrap here on the parameters used:</p><ul><li>Name is a string. All names have been added as constants to make it easier to select an icon. IntelliSense will help you find the right one. It is also using the new .NET 6 EditorRequired feature. If you don’t pass a value for the Name, Visual Studio will point that out to you in design time and raise a compile error when building.</li><li>Size is using an enum that holds all the possible valid sizes. Note that <strong>not all sizes are available for all icons</strong>. If you get an error at run-time, supply a different size or remove the parameter to fall back to the default size (IconSize.Size24).</li><li>Filled is a bool to choose a filled (true) or a regular/outlined (false) version of an icon.</li></ul><p>Other parameters (not shown in the example above) for this component are:</p><ul><li>UseAccentColor (bool). This parameter defaults to true and determines if the accent color is used for the fill or the outline when rendering the icon. When setting this to false, the icon will be rendered in black.</li><li>NeutralCultureName (string). Some icons offer alternative versions for specific languages. By supplying the two-letter neutral language code, you can indicate that you would like to use that specific version of an icon. The component will fall back to rendering the original version if there is no language-specific version.</li><li>Slot (string). With the slot parameter you can indicate where an icon needs to be rendered in the context of another component. For example, when combining a &lt;FluentButton&gt;with a &lt;FluentIcon&gt;, you can use the slot to put the icon in front of the button text:</li></ul><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/304154f7b00ac0b7f3f96c85bc654823/href">https://medium.com/media/304154f7b00ac0b7f3f96c85bc654823/href</a></iframe><p>Note that while the icon is positioned <strong>after </strong>the “Search” text in the markup, it will render <strong>before </strong>the button text because the slot=start. Here’s what it looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/124/1*XovH1V84upr7-VY-JeBSPA.png" /><figcaption>Image of a button with an icon</figcaption></figure><p>The <a href="https://brave-cliff-0c0c93310.azurestaticapps.net/IconPage">temporary demo site</a> has a page to search through all the available icons and sizes.</p><p>In earlier and other libraries, icons are often included using fonts. This method has the disadvantage that the whole font needs to be downloaded even if you only use one icon. Instead, we stepped away from using that method in this library and opted for taking the SVG route. Because the icons are SVG files stored in the wwwroot folder in an RCL (Razor Class Library), they are treated like static files on the server. They don’t get downloaded until requested, and only the icons you are actually using will be downloaded.</p><h3>Design Token support</h3><p>The Fluent UI Web Components are built on FAST’s Adaptive UI technology, enabling design customization and personalization while automatically maintaining accessibility. This is accomplished through setting various “Design Tokens”. In previous versions of this library, the only way to manipulate the design tokens was through using the &lt;FluentDesignSystemProvider&gt; component. This Blazor component (and its underlying Web Component) exposed over 60 variables that could be used to change things like typography, color, sizes, UI spacing, etc. FAST was extended a while ago and now has a much more granular way of working with individual design tokens instead of just a design system provider model. See <a href="https://docs.microsoft.com/en-us/fluent-ui/web-components/design-system/design-tokens">https://docs.microsoft.com/en-us/fluent-ui/web-components/design-system/design-tokens</a> for more information on how Design Tokens work.</p><p>In total, there are now over 160 distinct tokens defined in the Adaptive UI model, and as of version 1.4 of this library, you can use all these in Blazor as well! The implementation has been in the works for multiple months, and we think the result is quite flexible. It allows for usage both from C# code as well as declaratively in your .razor pages. The two ways of working with design tokens are described below (taken from the repository <a href="https://github.com/microsoft/fast-blazor/blob/main/README.md">readme</a>):</p><h3>Option 1: Using Design Tokens from C# code</h3><p>Given the following .razor page fragment:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03e3038cb4722fb1c11e98efaa7e75e5/href">https://medium.com/media/03e3038cb4722fb1c11e98efaa7e75e5/href</a></iframe><p>You can use Design Tokens to manipulate the styles from C# code as follows:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/550a630d191562fbd6d44d74e410882a/href">https://medium.com/media/550a630d191562fbd6d44d74e410882a/href</a></iframe><p>As seen in the code above (with the ref4.Element), it is possible to apply multiple tokens to the same component.</p><p>For Design Tokens that work with a color value, you must call the ToSwatch() extension method on a string value or use one of the Swatch constructors. This ensures the color uses a format that Design Tokens can handle. A Swatch has a lot of commonalities with the System.Drawing.Color struct. Instead of the values of the components being between 0 and 255, in a Swatch they are expressed as a value between 0 and 1.</p><blockquote><strong><em>⚠️ IMPORTANT</em></strong></blockquote><blockquote><em>The Design Tokens are manipulated through JavaScript interop working with an </em><em>ElementReference. There is no JavaScript element until after the component is rendered. This means you can only work with the Design Tokens from code after the component has been rendered in </em><em>OnAfterRenderAsync and not in any earlier lifecycle methods.</em></blockquote><h3>Option 2: Using Design Tokens as components</h3><p>The Design Tokens can also be used as components in a .razor page directly. It looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6958a962493c40de061aa6beddc62ce5/href">https://medium.com/media/6958a962493c40de061aa6beddc62ce5/href</a></iframe><p>To make this work, a link must be created between the Design Token component and its child components. This is done with the BackReference=&quot;@Context&quot; construct.</p><blockquote><strong><em>ℹ️ NOTE</em></strong></blockquote><blockquote><em>Only one Design Token component at a time can be used this way. If you need to set more tokens, use the code approach as described in</em> Option 1<em> above.</em></blockquote><p>Besides these two new options, the original &lt;FluentDesignSystemProvider&gt; component is still there and can be used as always. There are no plans to remove this anytime soon.</p><h3>XML Comments</h3><p>All components and all component parameters now have XML comments. This means that tools that support this, like Visual Studio IntelliSense, will show you information about methods and parameters when editing your razor pages and code, making it a bit easier to discover and understand functionality:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*Cf7DjIFJmyFOAF5Sc9TPzg.png" /><figcaption>Screenshot of IntelliSense in action</figcaption></figure><h3>Add FocusAsync to FluentInputBase</h3><p>It was not possible before to programmatically set focus to an &lt;input&gt; deriving component like the &lt;FluentTextField&gt; or &lt;FluentNumberField&gt;. The base class &lt;FluentInputBase&gt; has now been extended to expose this method.</p><h3>Wrapping Up</h3><p>We’re excited to bring these powerful new design token and icon capabilities to Blazor developers and can’t wait to see what you’ll build with them. As FAST and the Fluent UI Web Components evolve, we’ll continue to work hard to bring you more components, features, and improvements like these.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4c3ea55a4b56" width="1" height="1" alt=""><hr><p><a href="https://medium.com/fast-design/whats-new-in-the-microsoft-fluent-ui-library-for-blazor-versions-1-3-and-1-4-4c3ea55a4b56">What’s new in the Microsoft Fluent UI library for Blazor versions 1.3 and 1.4</a> was originally published in <a href="https://medium.com/fast-design">FAST</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>