<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mattia Astorino</title>
    <description>The latest articles on DEV Community by Mattia Astorino (@equinusocio).</description>
    <link>https://dev.to/equinusocio</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F51866%2Fede5cbb0-269a-4638-b484-cb298fda5af9.jpg</url>
      <title>DEV Community: Mattia Astorino</title>
      <link>https://dev.to/equinusocio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/equinusocio"/>
    <language>en</language>
    <item>
      <title>Paradox of choice in design systems.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Thu, 12 Nov 2026 08:38:15 +0000</pubDate>
      <link>https://dev.to/equinusocio/paradox-of-choice-in-design-systems-167a</link>
      <guid>https://dev.to/equinusocio/paradox-of-choice-in-design-systems-167a</guid>
      <description>&lt;p&gt;&lt;strong&gt;A good design system shouldn't maximize choices. It should minimize unnecessary decisions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In his famous TED Talk and book "More is less", The Paradox of Choice, Barry Schwartz challenges a common belief:&lt;/p&gt;

&lt;p&gt;More choices → More freedom → More happiness.&lt;/p&gt;

&lt;p&gt;But having more options comes with unexpected side effects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Decision paralysis: Too many alternatives make it harder to choose.&lt;/li&gt;
&lt;li&gt;Regret: Every choice reminds us of the opportunities we left behind. What if?&lt;/li&gt;
&lt;li&gt;Higher expectations: More possibilities make us less satisfied, even when we've made a great decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  So, what does this have to do with design systems?
&lt;/h2&gt;

&lt;p&gt;Quite a lot, actually.&lt;/p&gt;

&lt;p&gt;We often confuse flexibility with quality. More component variants, more properties, more configuration, more customization. But a component with 50 configurable properties isn't necessarily better than one with 5.&lt;/p&gt;

&lt;p&gt;Every additional option introduces another decision, another potential inconsistency, another opportunity to get something wrong.&lt;/p&gt;

&lt;p&gt;And this matters even more in the age of AI where it can generate endless interface variations in seconds. But without shared principles and constraints, more possibilities simply mean more unpredictable outcomes.&lt;/p&gt;

&lt;p&gt;This is one of the core ideas behind ViraUI (&lt;a href="https://viraui.dev" rel="noopener noreferrer"&gt;https://viraui.dev&lt;/a&gt;), the AI-centric design framework I'm building, finding the perfect balance between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Flexibility to create unique experiences.&lt;/li&gt;
&lt;li&gt;Predictability to make outcomes reliable.&lt;/li&gt;
&lt;li&gt;Consistency to scale across products and teams.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By giving designers, developers, and AI agents the right constraints, we can reduce decision fatigue without sacrificing creativity, while keeping high standards.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Because constraints aren't always limitations. Sometimes, they're what makes freedom possible.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>designsystem</category>
      <category>webdev</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Design Systems 2.0: The source of truth is the code.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Tue, 15 Sep 2026 14:51:31 +0000</pubDate>
      <link>https://dev.to/equinusocio/design-systems-20-the-source-of-truth-is-the-code-e01</link>
      <guid>https://dev.to/equinusocio/design-systems-20-the-source-of-truth-is-the-code-e01</guid>
      <description>&lt;h4&gt;
  
  
  There’s a lot of noise about design systems and AI right now, and much of it misses the point.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9azzwqqkpm2v1g00aclu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9azzwqqkpm2v1g00aclu.png" width="800" height="366"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Teams still treat a design system like a Figma library plus a style guide, then ask AI to help maintain that pile, which fights the medium: you’re asking a model to keep several copies of the same system aligned across static design files, docs, code, and guidelines. Drift isn’t a tooling bug; it’s what you get when truth lives in five places.&lt;/p&gt;

&lt;p&gt;A design system isn’t a deck of components on a canvas. It’s a shared language made real in product: tokens, foundations, components, patterns, and the rules that keep them coherent as the product changes. Split that language across tools with no single source, and every change becomes a reconciliation job. AI doesn’t fix that; it multiplies it.&lt;/p&gt;

&lt;p&gt;The better path looks almost opposite to how most teams work today. Code can live on a canvas in the browser, where designers edit it visually with AI in the loop and developers still edit it as code: same artifact, same truth. That isn’t a compromise between design and engineering. It’s the only workflow where AI works well, because the model reads and writes one thing it understands deeply: the system as implemented.&lt;/p&gt;

&lt;p&gt;Why put code at the center? Because code is the powerful part of the stack, and it’s what people actually see. A static design file is a proposal; the running interface is the product. That same code can be rendered in the browser as a visual canvas, close to how teams already think in Figma, while staying editable as real implementation. Designers get a surface they can shape, developers get source they can trust, and AI gets something it already understands natively: structured, executable interface code, not a picture of one. When the system lives there, you’re not translating between worlds. You’re working in the one that ships.&lt;/p&gt;

&lt;p&gt;Forcing AI into the old pipeline (mock, hand off, document, implement, hope the docs still match) optimizes for familiarity, not coherence. Maintain four or five surfaces and you create four or five chances to diverge; focus on one scope (the code) and the AI stays inside a single object. Alignment stops being a project and becomes a property of the process.&lt;/p&gt;

&lt;p&gt;That only works if you build a strong, platform-agnostic foundation underneath the system: not another layer of the product UI kit, but the substrate the system sits on, covering distribution, versioning, tokens, and a toolchain where the canvas and the code are the same conversation. Without that, “code as source of truth” is a slogan. With it, design and development can share one loop.&lt;/p&gt;

&lt;p&gt;I’m building &lt;a href="https://viraui.dev/" rel="noopener noreferrer"&gt;ViraUI&lt;/a&gt; around this idea. The workflow looks like this in my head.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Define the system with AI
&lt;/h3&gt;

&lt;p&gt;Before anyone draws a button or ships a package, you decide what the system is. That work is conversational and deliberate: you describe the product context, the audience, the constraints, and the interface language you want to own, then use AI to turn that intent into an explicit brief covering principles, UI tone of voice, aesthetic direction, density, motion posture, accessibility baselines, what “on brand” means in interaction terms, and what is out of scope.&lt;/p&gt;

&lt;p&gt;This is design-system design, not component production. You’re setting the rules the rest of the team will follow: how decisions get made, what consistency means here, and which tradeoffs you accept. The model helps you pressure-test those rules by surfacing contradictions, proposing alternatives, and turning vague taste into written constraints, while the team still owns the judgment. The output isn’t a library. It’s a shared definition clear enough that foundation work and later component work have something solid to build against, instead of reinventing taste in every pull request.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Engineers build the skeleton
&lt;/h3&gt;

&lt;p&gt;Once that identity is clear, engineering builds the substrate that makes code-as-truth real: tokens, themes, package distribution, versioning, docs generated from the same source that ships, and a toolchain that connects visual editing on a canvas (Storybook?) to the coded artefact developers already trust.&lt;/p&gt;

&lt;p&gt;This layer isn’t “part of the design system” in the product sense. It’s the platform-agnostic base underneath it, something that has to hold whether you render on the web today or extend later. Spacing, color, typography, elevation, focus behavior, and the rest become encoded contracts rather than slide-deck promises. The toolchain decides whether designers and developers meet on one object or keep bouncing between mirrors. Get this wrong and every AI-assisted edit becomes another sync problem; get it right and the canvas, the code, and the release pipeline describe the same system.&lt;/p&gt;

&lt;p&gt;Distribution is part of that job, and it has to include the documentation itself. If you want AI to work the way the team defined (inside the system’s rules, not beside them), ship the full docs with the design system and keep that material always up to date and reachable at the source, so an LLM can read it directly instead of scraping pages written for humans and then guessing what still matches reality. Human-facing docs go stale; this is a fact. They get paraphrased, pick up small errors, and those errors compound into drift. When the system package carries its own machine-readable contract, the model consumes the same truth the product ships. Vercel takes a similar path with Next.js: documentation travels with the framework so tools and models can use the source built from the source, not a secondhand rewrite of it.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Design builds on that foundation
&lt;/h3&gt;

&lt;p&gt;With foundations and toolchain in place, design can work where the product actually lives. Designers shape components and patterns with AI, inside the constraints engineering already encoded (spacing, color, typography, interaction rules, and the rest). They explore on the canvas: compose, refine, ask the model for variants, while every change lands in the same coded source developers will review, test, and ship.&lt;/p&gt;

&lt;p&gt;That changes the job. You’re no longer inventing a parallel truth in a static file and hoping implementation catches up. You’re authoring the system itself: components that respect the foundation, patterns that encode real product flows, and states and edge cases that usually die in handoff. AI speeds up exploration and boilerplate, and it stays useful because it operates on one scope (the living system), not on a Figma file, a docs site, and a repo that disagree by Thursday. Design leads the craft, the foundation keeps craft honest, and code remains the record.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The system lives
&lt;/h3&gt;

&lt;p&gt;From there, iteration is continuous. AI sits at the center of the process, not as an optional plugin on yesterday’s handoff. The system evolves in one place, with one source of truth, and so do the documentation and the guidelines that orchestrate it. The people who care about craft and the people who care about implementation finally work on the same object, not multiple representations of the same system.&lt;/p&gt;

&lt;p&gt;Design systems didn’t fail because teams lacked discipline. They strained under a model that duplicated truth and asked humans (and now models) to keep the copies honest. If AI can read and write interface code fluently, stop treating static design files and prose docs as peers of the implementation. Put the source of truth in code, give it a canvas, let designers and developers meet there, and let AI work where it’s strongest: on one living system, not on five shadows of one.&lt;/p&gt;

&lt;p&gt;That’s Design Systems 2.0: no more tools in the old workflow, but one workflow built around how AI actually works.&lt;/p&gt;




</description>
      <category>ai</category>
      <category>designsystems</category>
      <category>productdesign</category>
      <category>design</category>
    </item>
    <item>
      <title>AI won’t fix your design system.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Mon, 13 Apr 2026 10:20:54 +0000</pubDate>
      <link>https://dev.to/equinusocio/ai-wont-fix-your-design-system-57c</link>
      <guid>https://dev.to/equinusocio/ai-wont-fix-your-design-system-57c</guid>
      <description>&lt;h4&gt;
  
  
  Automation can accelerate a healthy system. It cannot repair a broken one.
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvsio1h92ul466xw5yws.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbvsio1h92ul466xw5yws.png" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many teams still treat Design Systems as if they were mostly a UI artifact: a component library, a token set, a Figma file, a Storybook instance, maybe some documentation on top.&lt;/p&gt;

&lt;p&gt;That is usually where the problem starts.&lt;/p&gt;

&lt;p&gt;A real Design System is not just a reusable UI layer. It is an internal product with its own operating model. It needs ownership, governance, maintenance, adoption, and alignment with the teams that depend on it.&lt;/p&gt;

&lt;p&gt;Without that structure, what companies call a Design System is often just a library waiting to drift.&lt;/p&gt;

&lt;p&gt;That is why so many systems look solid at launch and then start degrading a few months later. Product teams reintroduce inconsistencies. Designers bypass patterns. Developers fork components locally. The gap between design and code becomes accepted as normal. At that point, the conversation usually turns to tooling. Teams start asking whether they need better tokens, better documentation, better plugins, better automation, or now, better AI.&lt;/p&gt;

&lt;p&gt;But most Design Systems do not fail because they lack tools. They fail because they lack structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  The wrong abstraction.
&lt;/h3&gt;

&lt;p&gt;One of the most common misconceptions is thinking that a Design System is the sum of its artifacts. Components, tokens, guidelines, libraries, assets, documentation.&lt;/p&gt;

&lt;p&gt;Those things matter, but they are outputs of the system, not the system itself.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A component library is not a Design System.&lt;/li&gt;
&lt;li&gt;A token architecture is not a Design System.&lt;/li&gt;
&lt;li&gt;A Figma library is not a Design System.&lt;/li&gt;
&lt;li&gt;An AI-powered workflow is not a Design System.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The real role of a Design System is to create a reliable relationship between recurring product needs and reusable system decisions. That requires a lot more than assets. It requires ownership, role clarity, and a governance model that defines how the system evolves over time.&lt;/p&gt;

&lt;p&gt;If there is no clear process for how teams contribute, how requests are evaluated, how exceptions are handled, and how design and code stay aligned, then the system is not really operating. It is just being referenced.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Design System is an organizational system.
&lt;/h3&gt;

&lt;p&gt;The moment multiple teams depend on a Design System, it becomes infrastructure. It stops being a side project and becomes an internal product serving other internal teams.&lt;/p&gt;

&lt;p&gt;And internal products need what all products need: clear ownership, priorities, maintenance, quality control, support, release discipline, and feedback loops.&lt;/p&gt;

&lt;p&gt;This is the part many organizations underestimate. They invest in building the first version of the system, but not in structuring the model that allows it to survive real product pressure.&lt;/p&gt;

&lt;p&gt;Because product teams will always be under pressure. They will always receive urgent requests, edge cases, customer-specific needs, and business constraints. If the Design System cannot absorb that pressure with a clear operating model, teams will work around it.&lt;/p&gt;

&lt;p&gt;That is not a tooling problem.&lt;/p&gt;

&lt;p&gt;That is a governance problem.&lt;/p&gt;

&lt;h3&gt;
  
  
  Competence coverage is what keeps a system real.
&lt;/h3&gt;

&lt;p&gt;In my experience, the strongest Design Systems are not defined by the tools they use. They are defined by how well they cover the competencies required to evolve the system properly.&lt;/p&gt;

&lt;p&gt;A healthy Design System team usually needs at least three perspectives working together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;UI design&lt;/strong&gt; , to shape the component architecture and visual system&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UX design&lt;/strong&gt; , to define patterns, accessibility, and behavioral consistency&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Front-end UI engineering&lt;/strong&gt; , to implement and evolve the coded system as part of the Design System itself&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That last part is where many companies fail.&lt;/p&gt;

&lt;p&gt;If nobody owns the coded UI at system level, design and implementation will drift apart. Eventually, the product teams become the place where design decisions are reinterpreted under delivery pressure. Every mismatch becomes a local workaround. Every workaround becomes fragmentation.&lt;/p&gt;

&lt;p&gt;The front-end engineer inside the Design System team is not there just to “code components.” They are there to co-author the system, keep design intent honest in implementation, and ensure that APIs, constraints, behaviors, and abstractions evolve coherently.&lt;/p&gt;

&lt;p&gt;Without that role, the system is often just design direction with weak implementation control.&lt;/p&gt;

&lt;h3&gt;
  
  
  Product teams should consume the system, not redefine it.
&lt;/h3&gt;

&lt;p&gt;A mature Design System does not work because product teams are unusually disciplined. It works because the boundaries are clear.&lt;/p&gt;

&lt;p&gt;The Design System team defines and evolves the system.&lt;br&gt;&lt;br&gt;
Product teams use it, stress it, and surface new needs.&lt;/p&gt;

&lt;p&gt;That distinction matters.&lt;/p&gt;

&lt;p&gt;A product designer should compose interfaces using the system and align with the Design System team when something falls outside it. A front-end developer in the product team should build using the system’s coded components and escalate when the implementation need goes beyond what the system supports.&lt;/p&gt;

&lt;p&gt;When those boundaries are weak, product teams stop consuming the system and start mutating it. That is when the Design System slowly turns into multiple local interpretations of the same idea.&lt;/p&gt;

&lt;p&gt;AI can make this worse if used carelessly. It allows teams to generate local UI solutions faster than ever. But speed is not alignment. Generating more code does not mean generating more system.&lt;/p&gt;

&lt;h3&gt;
  
  
  Governance is the missing layer.
&lt;/h3&gt;

&lt;p&gt;This is why governance matters so much.&lt;/p&gt;

&lt;p&gt;Governance is not bureaucracy. It is the mechanism that decides what happens when product teams need something the system does not yet provide.&lt;/p&gt;

&lt;p&gt;Brad Frost described this clearly in 2019, and his governance flow still holds up remarkably well today. The model shows a much healthier operating path than what many teams still have in practice: product teams begin with the Design System, verify whether the solution already exists, align with the Design System team when it does not, distinguish between reusable system work and one-off needs, and then move through prioritization, implementation, testing, documentation, release, and adoption.&lt;/p&gt;

&lt;p&gt;Brad Frost described this clearly in 2019, and his governance flow still holds up remarkably well today. You can see the diagram here: &lt;a href="https://coggle.it/diagram/XTZ3TKMV3SdbE6Pq/t/product-team-comes-to-design-help-design-and-build-new-work/6a980806f82da5777174934f9cd27fdb6f4b06c9c211ac92191a7619e1aa8e6b" rel="noopener noreferrer"&gt;&lt;strong&gt;Brad Frost’s Design System governance flow&lt;/strong&gt;&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;That is what many teams are missing: not another library, but an operational path between product demand and system evolution.&lt;/p&gt;

&lt;p&gt;A real Design System is not just reusable UI. It is a governance layer between recurring product needs and reusable decisions. That is what makes it sustainable. Next step is to find out how AI can help improve this.&lt;/p&gt;

&lt;h3&gt;
  
  
  AI can automate tasks. It cannot replace judgment.
&lt;/h3&gt;

&lt;p&gt;This is where AI becomes interesting, but only if placed in the right part of the model.&lt;/p&gt;

&lt;p&gt;AI can absolutely reduce the cost of Design System work. It can help with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;generating component scaffolding and tests&lt;/li&gt;
&lt;li&gt;transforming tokens across platforms&lt;/li&gt;
&lt;li&gt;auditing usage across repositories&lt;/li&gt;
&lt;li&gt;drafting documentation and migration notes&lt;/li&gt;
&lt;li&gt;spotting duplicate variants&lt;/li&gt;
&lt;li&gt;surfacing accessibility issues&lt;/li&gt;
&lt;li&gt;accelerating code reviews and refactors&lt;/li&gt;
&lt;li&gt;identifying repeated exceptions that may deserve consolidation&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That is real leverage.&lt;/p&gt;

&lt;p&gt;But none of that removes the need for ownership, governance, and judgment. But how AI can help us?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AI can help classify patterns. It cannot decide what should become part of the system.&lt;/li&gt;
&lt;li&gt;AI can help draft docs. It cannot own the system contract.&lt;/li&gt;
&lt;li&gt;AI can help generate implementation faster. It cannot decide whether the abstraction is right.&lt;/li&gt;
&lt;li&gt;AI can help detect repetition. It cannot determine whether repetition deserves systemization.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Those are design system decisions, not generation tasks. This is the mistake many teams are about to make: automating a weak system and mistaking acceleration for maturity.&lt;/p&gt;

&lt;p&gt;A broken Design System with AI is still a broken Design System. It just scales chaos faster.&lt;/p&gt;

&lt;h3&gt;
  
  
  Snowflakes still need governance.
&lt;/h3&gt;

&lt;p&gt;Not every new request should become part of the system. That is another sign of maturity many teams miss.&lt;/p&gt;

&lt;p&gt;Some needs are local. Some are temporary. Some are too specific to deserve promotion into the shared layer. Mature systems know how to handle these “snowflakes” without either blocking teams or polluting the system with premature abstractions.&lt;/p&gt;

&lt;p&gt;AI may help detect when multiple snowflakes are actually converging into a pattern. That is useful. But promotion into the system still requires human ownership and accountability.&lt;/p&gt;

&lt;p&gt;Recognition is not the same as decision.&lt;/p&gt;

&lt;p&gt;A healthy Design System needs both: the discipline to reject what should remain local, and the judgment to promote what has clearly become reusable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If everything becomes custom, the system is broken. If nothing new can ever enter the system, the system is dead.&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Fix the structure before you automate it.
&lt;/h3&gt;

&lt;p&gt;When a Design System starts drifting, the default reaction is often to redesign the artifacts. Update the components. Clean up the tokens. Refresh the docs. Add automation. Add AI.&lt;/p&gt;

&lt;p&gt;Sometimes that helps, but very often the real redesign needed is organizational.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Look at who owns coded UI.&lt;/li&gt;
&lt;li&gt;Look at how product teams escalate new needs.&lt;/li&gt;
&lt;li&gt;Look at how exceptions are classified.&lt;/li&gt;
&lt;li&gt;Look at how design and engineering stay aligned inside the system.&lt;/li&gt;
&lt;li&gt;Look at whether governance actually exists as a process, not just as a good intention.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then think about automation. Because the order matters.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First structure, then scale.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;First ownership, then automation.&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;First governance, then acceleration.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A Design System is not a library of reusable pieces. It is a product, a process, and a decision-making structure for interface work across teams.&lt;/p&gt;

&lt;p&gt;If that structure is missing, neither the library nor the AI will save you.&lt;/p&gt;




</description>
      <category>design</category>
      <category>designprocess</category>
      <category>designsystems</category>
      <category>business</category>
    </item>
    <item>
      <title>The cost of over-abstraction in design tokens.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Sat, 11 Apr 2026 21:23:55 +0000</pubDate>
      <link>https://dev.to/equinusocio/the-cost-of-over-abstraction-in-design-tokens-5529</link>
      <guid>https://dev.to/equinusocio/the-cost-of-over-abstraction-in-design-tokens-5529</guid>
      <description>&lt;p&gt;Why resisting unnecessary abstraction is the key to real consistency.&lt;/p&gt;

&lt;p&gt;Nobody talks about the power of resisting unnecessary abstraction.&lt;/p&gt;

&lt;p&gt;Yet most design systems fail at scale for exactly this reason. Not because they lack tokens, or tooling, or documentation, but because they abstract too early, too much, and in the wrong place.&lt;/p&gt;

&lt;p&gt;This article is about a simple idea:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Design tokens are not semantic. And confusing them with theme tokens breaks consistency across your entire system.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  Where things start to break.
&lt;/h3&gt;

&lt;p&gt;A common pattern in many design systems looks harmless:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34v7h2wpz8xtfiaskxxz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F34v7h2wpz8xtfiaskxxz.png" width="631" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Theme: Vira Theme Ocean&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;At first glance, this feels clean. Even intuitive. But this is already the point where the system starts leaking.&lt;/p&gt;

&lt;p&gt;These tokens are no longer just values. They encode intent. They carry assumptions about usage. “Primary” relative to what? “Text” in which context? What happens when the same color is reused somewhere else, with a slightly different role?&lt;/p&gt;

&lt;p&gt;The moment a token knows how it will be used, it stops being a token. It becomes a decision embedded in the system.&lt;/p&gt;

&lt;p&gt;And that decision will eventually conflict with another one.&lt;/p&gt;

&lt;h3&gt;
  
  
  The part nobody considers: people.
&lt;/h3&gt;

&lt;p&gt;Over-abstraction is usually framed as a technical problem. It isn’t. It’s a cognitive one.&lt;/p&gt;

&lt;p&gt;When new people join a team, they don’t see architecture diagrams or carefully crafted abstractions. They see names. And they try to understand them.&lt;/p&gt;

&lt;p&gt;Something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdbpmrghubi42h23acqdk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdbpmrghubi42h23acqdk.png" width="668" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Theme: Vira Theme Ocean&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;This is not expressive. It’s opaque.&lt;/p&gt;

&lt;p&gt;There is no shared, objective meaning for “subtle”. There is no clear boundary between “primary” and “secondary” unless someone explains it. The system requires interpretation, and interpretation requires context, and context lives in people’s heads.&lt;/p&gt;

&lt;p&gt;So instead of reducing complexity, the system relocates it.&lt;/p&gt;

&lt;p&gt;New contributors slow down. They ask questions. They hesitate before changing anything. Over time, the system becomes something only a few people truly understand.&lt;/p&gt;

&lt;p&gt;Resisting unnecessary abstraction is not just about cleaner architecture. It directly impacts how fast a team can operate.&lt;/p&gt;

&lt;h3&gt;
  
  
  A simpler mental model.
&lt;/h3&gt;

&lt;p&gt;Strip everything down and there are only two layers that matter:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Design Tokens → Theme Tokens → UI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Anything beyond this is usually an attempt to compensate for a broken foundation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Formalizing the model
&lt;/h3&gt;

&lt;p&gt;At this point, the distinction becomes very precise.&lt;/p&gt;

&lt;p&gt;Design tokens and theme tokens don’t just play different roles.&lt;br&gt;&lt;br&gt;
They follow completely different rules.&lt;/p&gt;

&lt;h4&gt;
  
  
  Design tokens (foundation layer — primitive)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They don’t change across implementations. They are constants.&lt;/li&gt;
&lt;li&gt;They are platform-agnostic raw data and must be transformed for each platform (web, iOS, Android).&lt;/li&gt;
&lt;li&gt;They don’t include platform-specific units like px, rem, or dvh.&lt;/li&gt;
&lt;li&gt;They are non-semantic. They represent absolute values.&lt;/li&gt;
&lt;li&gt;They are the single source of truth for consistency across the system.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Theme tokens (mapping layer — semantic)
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They don’t follow the same constraints.&lt;/li&gt;
&lt;li&gt;Their values can change across implementations and platforms.&lt;/li&gt;
&lt;li&gt;They are semantic and context-aware.&lt;/li&gt;
&lt;li&gt;They are inherently platform-aware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If these two layers share the same rules, the system collapses.&lt;br&gt;&lt;br&gt;
Their separation is what makes the system scalable.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9prkslp5or52j5flrwfb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F9prkslp5or52j5flrwfb.png" width="800" height="393"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  What design tokens actually are
&lt;/h3&gt;

&lt;p&gt;Design tokens are often described as “variables for design”. That’s wrong, and it leads to misuse. Actually, they are the opposite.&lt;/p&gt;

&lt;p&gt;A more accurate definition is this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Design tokens are immutable, non-semantic constants that represent raw design decisions.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;They are not meant to describe intent. They don’t know anything about components, states, or usage. They are just values, expressed in a way that can be shared across platforms.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9hpt3pyzsp9j6gu0q7t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj9hpt3pyzsp9j6gu0q7t.png" width="686" height="564"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Theme: Vira Theme Ocean&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;There is no “primary”, no “background”, no “button”. Just a set of constants.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;That’s the point.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;These values should not change depending on where they are used. They are the most stable layer of the system. If something changes here, it should be a deliberate, system-wide decision — not a contextual tweak.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where platform differences actually belong.
&lt;/h3&gt;

&lt;p&gt;One of the most common mistakes is embedding platform concerns directly into tokens. Units, formats, even behavior end up leaking into what should be a pure data layer.&lt;/p&gt;

&lt;p&gt;That responsibility belongs somewhere else: the transformation layer. The layers handled by tools like &lt;a href="https://styledictionary.com/" rel="noopener noreferrer"&gt;Style Dictionary,&lt;/a&gt; &lt;a href="https://diez.org/" rel="noopener noreferrer"&gt;Diez&lt;/a&gt;, and others that transform raw tokens to platform-specific values.&lt;/p&gt;

&lt;p&gt;The same spacing token might become 0.625rem on the web, 10 on iOS, or 10dp on Android. The value is the same. Only its representation changes.&lt;/p&gt;

&lt;p&gt;Once you accept this, a lot of accidental complexity disappears. Tokens stop being tied to a specific implementation, and the system becomes portable and multi-platform by design.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reintroducing meaning, in the right place.
&lt;/h3&gt;

&lt;p&gt;Semantics are not the problem. Misplacing them is.&lt;/p&gt;

&lt;p&gt;This is where theme tokens come in.&lt;/p&gt;

&lt;p&gt;Theme tokens are the layer where raw values are mapped to meaning. They define what a color represents in a given context, and they are allowed to change. A background color can be different in dark mode. A text color can shift depending on brand or product.&lt;/p&gt;

&lt;p&gt;For example:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8m7ws1fb981w48swj4oo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8m7ws1fb981w48swj4oo.png" width="686" height="403"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Theme: Vira Theme Carbon&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here, the system becomes expressive again, but without losing control. The mapping is explicit, and it can evolve independently from the underlying values.&lt;/p&gt;

&lt;h3&gt;
  
  
  Where most systems overreach.
&lt;/h3&gt;

&lt;p&gt;The instinct to abstract doesn’t stop at theme tokens. Many systems keep going, trying to encode every possible variation into the token structure itself.&lt;/p&gt;

&lt;p&gt;That’s how you end up with things like:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68i7vla6fdwinkqwdjvc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F68i7vla6fdwinkqwdjvc.png" width="712" height="382"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Theme: Vira Theme Graphene&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;At that point, the system is no longer flexible. It is describing UI, not enabling it.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every new state, variant, or component adds another layer of naming. The token space grows exponentially, and small changes become expensive. Refactoring requires touching multiple layers that should never have existed in the first place.&lt;/p&gt;

&lt;p&gt;What started as an attempt to create clarity ends up creating rigidity.&lt;/p&gt;

&lt;h3&gt;
  
  
  What changes when you simplify
&lt;/h3&gt;

&lt;p&gt;When design tokens remain raw and non-semantic, and semantics are isolated in theme tokens, the system behaves differently.&lt;/p&gt;

&lt;p&gt;Changes become predictable. Themes can evolve without rewriting the foundation. Platforms can diverge where needed without breaking consistency. New contributors can understand the system without decoding it.&lt;/p&gt;

&lt;p&gt;Most importantly, the system stops fighting back.&lt;/p&gt;

&lt;p&gt;Consistency is no longer enforced through conventions and documentation. It emerges from the structure itself.&lt;/p&gt;

&lt;h3&gt;
  
  
  Final thought
&lt;/h3&gt;

&lt;p&gt;Design tokens are often framed as a naming problem. They are not.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;They are a problem of boundaries.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Once tokens start carrying meaning, those boundaries collapse. And when that happens, everything becomes harder: theming, scaling, onboarding, even simple changes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;If your tokens are semantic, they are not tokens anymore. They are already UI.&lt;/strong&gt;&lt;/p&gt;




</description>
      <category>tokendesign</category>
      <category>design</category>
      <category>softwaredevelopment</category>
      <category>scalability</category>
    </item>
    <item>
      <title>AI skills are the new NPM packages</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Fri, 03 Apr 2026 06:54:28 +0000</pubDate>
      <link>https://dev.to/equinusocio/ai-skills-are-the-new-npm-packages-1cb1</link>
      <guid>https://dev.to/equinusocio/ai-skills-are-the-new-npm-packages-1cb1</guid>
      <description>&lt;p&gt;&lt;strong&gt;We used to share code. Now we share intent.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For years, our industry has been built around one core idea: reuse.&lt;br&gt;&lt;br&gt;
npm packages, shared libraries, frameworks — all ways to take someone else's solution and plug it into our own system.&lt;/p&gt;

&lt;p&gt;It worked. It scaled. It shaped how we build software.&lt;/p&gt;

&lt;p&gt;But there's always been a hidden cost.&lt;/p&gt;

&lt;p&gt;When you import a package, you're not just importing functionality — you're importing decisions.&lt;br&gt;&lt;br&gt;
Architecture choices, naming conventions, constraints, trade-offs made by someone else, often in a different context.&lt;/p&gt;

&lt;p&gt;Sometimes that's exactly what you want.&lt;br&gt;&lt;br&gt;
Other times, it's friction you carry for the lifetime of your product.&lt;/p&gt;




&lt;h2&gt;
  
  
  From code to knowledge
&lt;/h2&gt;

&lt;p&gt;I've been thinking about this a lot lately, especially with the rise of AI in our workflows.&lt;/p&gt;

&lt;p&gt;And I keep coming back to the same idea: &lt;strong&gt;AI skills are becoming the new npm packages.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But instead of distributing opinionated implementations, we're starting to distribute something more flexible — and arguably more valuable: &lt;strong&gt;expertise&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;An AI skill doesn't give you code to reuse.&lt;br&gt;&lt;br&gt;
It gives you a way to think.&lt;/p&gt;

&lt;p&gt;It captures how someone approaches a problem — the constraints they consider, the trade-offs they make, the patterns they recognize — without forcing you into a specific stack or architecture.&lt;/p&gt;

&lt;p&gt;That's a very different kind of abstraction.&lt;/p&gt;

&lt;p&gt;We're moving from sharing &lt;strong&gt;solutions&lt;/strong&gt; to sharing &lt;strong&gt;reasoning&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why this shift matters
&lt;/h2&gt;

&lt;p&gt;With traditional packages, reuse comes with coupling.&lt;/p&gt;

&lt;p&gt;You gain speed, but you inherit structure, opinions, and implementation.&lt;/p&gt;

&lt;p&gt;With AI skills, the relationship flips.&lt;/p&gt;

&lt;p&gt;You still benefit from someone else's experience, but you stay in control of the implementation. The output adapts to your context — your codebase, your constraints, your product.&lt;/p&gt;

&lt;p&gt;This decoupling is subtle, but powerful.&lt;/p&gt;

&lt;p&gt;It means that expertise becomes portable in a way it never really was before.&lt;/p&gt;

&lt;p&gt;Not as blog posts.&lt;br&gt;&lt;br&gt;
Not as documentation.&lt;br&gt;&lt;br&gt;
But as something you can actually use in your daily work.&lt;/p&gt;




&lt;h2&gt;
  
  
  What this looks like in design systems
&lt;/h2&gt;

&lt;p&gt;This shift becomes very real when you look at design systems.&lt;/p&gt;

&lt;p&gt;Traditionally, a design system is distributed as a set of components, core elements, and guidelines. You build a system, document it, and teams consume it.&lt;/p&gt;

&lt;p&gt;The true value of a design system lies not simply in the sum of its individual parts.&lt;br&gt;&lt;br&gt;
It's the decisions behind them.&lt;/p&gt;

&lt;p&gt;Why a component behaves a certain way.&lt;br&gt;&lt;br&gt;
Why a pattern exists.&lt;br&gt;&lt;br&gt;
When to use it — and when not to.&lt;/p&gt;

&lt;p&gt;Those things are hard to encode in code, and this is where AI skills start to change the game.&lt;/p&gt;

&lt;p&gt;Imagine a design system not just as a static library, but as a skill you can query.&lt;/p&gt;

&lt;p&gt;Instead of browsing documentation, a developer could ask:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Generate a table component API consistent with our system, including accessibility constraints and edge cases."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Instead of manually reviewing UI, you could run a skill that analyzes a screen and flags inconsistencies with your design tokens, spacing rules, or interaction patterns.&lt;/p&gt;

&lt;p&gt;Instead of onboarding someone through pages of docs, you could have a skill that explains your system in context — why things are built the way they are, not just what exists.&lt;/p&gt;

&lt;p&gt;In all these cases, you're no longer distributing just the output of the system.&lt;br&gt;&lt;br&gt;
You're distributing the thinking behind it.&lt;/p&gt;




&lt;h2&gt;
  
  
  A different kind of reuse
&lt;/h2&gt;

&lt;p&gt;What's interesting is that this doesn't replace traditional systems — it complements them.&lt;/p&gt;

&lt;p&gt;You still need components.&lt;br&gt;&lt;br&gt;
You still need code.&lt;/p&gt;

&lt;p&gt;But now there's another layer on top: a layer where knowledge itself becomes reusable.&lt;/p&gt;

&lt;p&gt;And that changes the nature of what we build and share.&lt;/p&gt;

&lt;p&gt;As someone working in UI and design systems, this feels particularly relevant.&lt;/p&gt;

&lt;p&gt;Because so much of the work has always been about decisions, consistency, and trade-offs — things that don't live comfortably in code alone.&lt;/p&gt;

&lt;p&gt;AI skills give us a way to package that part of the work.&lt;/p&gt;




&lt;h2&gt;
  
  
  Not without risks
&lt;/h2&gt;

&lt;p&gt;Of course, this isn't automatically better.&lt;/p&gt;

&lt;p&gt;A poorly designed skill can be just as harmful as a poorly designed library — maybe even more, because it's less visible.&lt;/p&gt;

&lt;p&gt;There's also a real risk of superficial outputs if the underlying thinking isn't solid.&lt;/p&gt;

&lt;p&gt;And we're still relying on models we don't fully control.&lt;/p&gt;

&lt;p&gt;So this isn't about replacing engineering discipline with prompts.&lt;/p&gt;

&lt;p&gt;It's about adding a new layer — one that needs just as much care, if not more.&lt;/p&gt;




&lt;h2&gt;
  
  
  Closing thought
&lt;/h2&gt;

&lt;p&gt;NPM packages helped us scale our code, while AI skills could help us scale our thinking.&lt;/p&gt;

&lt;p&gt;This represents a deeper shift than it initially appears.&lt;/p&gt;

&lt;p&gt;We're not just sharing what we build anymore.&lt;br&gt;&lt;br&gt;
We're starting to share how we think.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>webdev</category>
      <category>designsystem</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Vira Theme: A Deep Dive into the Premium Successor of Material Theme</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Mon, 30 Jun 2025 09:34:27 +0000</pubDate>
      <link>https://dev.to/equinusocio/vira-theme-a-deep-dive-into-the-premium-successor-of-material-theme-1bmb</link>
      <guid>https://dev.to/equinusocio/vira-theme-a-deep-dive-into-the-premium-successor-of-material-theme-1bmb</guid>
      <description>&lt;p&gt;If you've ever loved Material Theme in VS Code, you're going to fall for Vira Theme — it’s the premium evolution, tailored for dark-mode devotees and polished enough to keep developer workflows in mind.&lt;/p&gt;




&lt;h2&gt;
  
  
  What is Vira Theme?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Material Theme lineage&lt;/strong&gt; — Vira is the official successor of Material Theme, which powered over 9 million users over 10 years of free service. It retains and improve the beloved aesthetics, while evolving in form and function. Vira Theme, which has been in the works for a whole year, is like the next big thing after Material Theme.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
  &lt;tbody&gt;
&lt;tr&gt;
    &lt;td&gt;
      &lt;h4&gt;Teal&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/teal.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Fteal.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;h4&gt;Ocean&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/ocean.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Focean.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;h4&gt;Carbon&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/carbon.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Fcarbon.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;
      &lt;h4&gt;Palenight&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/palenight.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Fpalenight.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;h4&gt;Graphene&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/graphene.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Fgraphene.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
    &lt;td&gt;
      &lt;h4&gt;Deepforest&lt;/h4&gt;
      &lt;a href="https://vira-themes.github.io/vira-theme-support/assets/previews/deepforest.webp" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fvira-themes.github.io%2Fvira-theme-support%2Fassets%2Fpreviews%2Fdeepforest.webp" width="800" height="400"&gt;&lt;/a&gt;
    &lt;/td&gt;
  &lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Exclusively Dark with Distinct Flavor
&lt;/h2&gt;

&lt;p&gt;Vira smartly drops light variants to focus on creating cohesive and polished dark themes, eliminating dilution of effort.&lt;/p&gt;

&lt;p&gt;Choose from &lt;strong&gt;Ocean&lt;/strong&gt;, &lt;strong&gt;Teal&lt;/strong&gt;, &lt;strong&gt;Palenight&lt;/strong&gt;, &lt;strong&gt;Graphene&lt;/strong&gt;, &lt;strong&gt;Deepforest&lt;/strong&gt;, and the star of the show — the new &lt;strong&gt;Carbon&lt;/strong&gt; variant with a near-black background and desaturated syntax coloring.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hand‑crafted Icons &amp;amp; Auto‑Accent Sync
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5son3gjdf1oub6az4ovo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5son3gjdf1oub6az4ovo.png" alt="Vira Icons" width="799" height="195"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With &lt;strong&gt;over 320 curated file and folder icons&lt;/strong&gt;, each one is uniquely designed and updated to keep your app looking sharp and modern. Plus, automatic accent synchronization links your icon colors with your theme accent, so you can have a unified UI without any hassle.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deep Customization
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxn6wmmkm0sg4yawpzqv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxn6wmmkm0sg4yawpzqv.png" alt="Vira Theme Settings" width="799" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Vira lets you customize your experience from the command palette or settings. Here are some options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Accent color&lt;/strong&gt;: Choose an accent color or set your.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Outlined folder icons&lt;/strong&gt;: Toggle icon styles to match your style.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Explorer arrows visibility&lt;/strong&gt;: Choose between a clean or structured look.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Editor borders&lt;/strong&gt;: Enable borders to visually distinguish editor sections.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Modern line highlight&lt;/strong&gt;: Choose between a legacy or bold-highlight style.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hide shadows&lt;/strong&gt;: Remove unwanted elevation indicators. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://vira.build/#settings" rel="noopener noreferrer"&gt;Lear more about settings.&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  Deps no thanks
&lt;/h2&gt;

&lt;p&gt;Vira Theme is a refreshing change from Material Theme and all the other abandoned clones out there. It’s completely dependency-free, meaning there are no dead dependencies in the final bundle. Plus, you don’t have to download any third-party code. This means no security risks — &lt;a href="https://github.com/microsoft/vsmarketplace/issues/1173#issuecomment-2716936212" rel="noopener noreferrer"&gt;and it’s never been the case&lt;/a&gt;, never trust hate-baiting on internet, they just want to monetize with hate and harassment.&lt;/p&gt;




&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The Material Theme remains functional. However, the VSCode team has implemented policies that make deprecated extensions unavailable. This decision is not within our control. If you locate the VSIX file, you may proceed with its installation and usage, acknowledging the potential consequences.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Upgrading to the Vira Theme is not mandatory; no one compels you to migrate from Material Theme. VS Code merely suggests a replacement. If you are dissatisfied with it, you are free to use other extensions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Vira Theme is distinct from the Material Theme. It has undergone a comprehensive overhaul over the past year and a half, incorporating numerous updates, new icons, and features that are not present in the Material Theme.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We offer discount codes to help migrating&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  SUMMER SALES ARE HERE! 🎉
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;After your 7-day free trial&lt;/strong&gt;, you can use the code &lt;code&gt;E0NZIZNW&lt;/code&gt; (valid until &lt;strong&gt;July 30, 2025&lt;/strong&gt;) to get a &lt;strong&gt;35% discount on the 6-activations&lt;/strong&gt; license! No subscription, no fees.&lt;/p&gt;

&lt;p&gt;&lt;a&gt;Try for free&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>design</category>
      <category>vscode</category>
      <category>ux</category>
    </item>
    <item>
      <title>Design with the A+R model</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Fri, 22 Nov 2024 11:30:34 +0000</pubDate>
      <link>https://dev.to/equinusocio/design-adaptive-e-responsive-con-il-modello-a-r-4jon</link>
      <guid>https://dev.to/equinusocio/design-adaptive-e-responsive-con-il-modello-a-r-4jon</guid>
      <description>&lt;h2&gt;
  
  
  What Happens when we combine Adaptive and Responsive design?
&lt;/h2&gt;

&lt;p&gt;Responsive and adaptive design are two approaches used to make websites work on any device, regardless of screen size, ensuring the best user experience. Both aim to optimize screen space and interaction methods, whether users rely on precise pointers or gestures. Before diving into the &lt;strong&gt;A + R&lt;/strong&gt; model, let’s briefly go over both approaches.&lt;/p&gt;

&lt;p&gt;A &lt;strong&gt;responsive&lt;/strong&gt; approach to design uses CSS and/or JS to adapt layouts and content based on predefined “breakpoints.” On the other hand, the &lt;strong&gt;adaptive&lt;/strong&gt; method provides pre-structured templates tailored to the type of device being used. The former predicts and defines when layouts and content need to change based on orientation, screen size, or content, while the latter delivers targeted experiences based on one key factor: the type of device (and by extension, user) accessing the service. The main difference lies in the structure of the content and HTML. In a responsive approach, the HTML and content structure remain the same (unless JavaScript is used to remove content from the structure) and adapt to different situations. In contrast, adaptive design involves different structures, layouts, and potentially unique experiences.&lt;/p&gt;

&lt;p&gt;Contrary to popular belief, the adaptive approach is widely used in web applications. For instance, creating specific experiences for on-the-go scenarios, where information needs to be easy to access, or for more comfortable desktop settings is common. Twitter, GitHub, and Facebook are prime examples of adaptive design in action.&lt;/p&gt;

&lt;p&gt;Both approaches are valid and widely used. To choose the right one, ask yourself the following questions:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How many components and how much complexity does the project involve?
&lt;/li&gt;
&lt;li&gt;Do users have the same expectations and interactions as desktop users?&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Responsive Design Techniques
&lt;/h3&gt;

&lt;p&gt;When building a responsive experience, there are three main techniques for managing layouts and content:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reflow:&lt;/strong&gt; This involves changing the layout structure to use the available space best. Most of the time, the result is content being stacked vertically. While easy, this approach isn’t always the best choice.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r33nwcwjnc388h7pzak.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5r33nwcwjnc388h7pzak.gif" alt=" " width="799" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Resize:&lt;/strong&gt; Interface components are designed to be fluid, much like most HTML elements. They fill the available space, and the content adjusts to fit the new dimensions.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7fnwj5vhzxu71k1gfim.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz7fnwj5vhzxu71k1gfim.gif" alt=" " width="799" height="493"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Show/Hide:&lt;/strong&gt; Some interface parts are hidden (but still exist in the structure) or shown, depending on the available space.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fshcmtgwujn3vyt4qf887.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fshcmtgwujn3vyt4qf887.gif" alt=" " width="760" height="469"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adaptive Design Technique
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Restructuring:&lt;/strong&gt; The adaptive approach allows for the development and distribution of different layouts to provide the best experience for specific contexts, such as gesture-only devices or hybrid touch devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe64enzncuwc3ow7hj1j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foe64enzncuwc3ow7hj1j.png" width="720" height="450"&gt;&lt;/a&gt;&lt;/p&gt;
Different experiences, different usage


&lt;h2&gt;
  
  
  Introduction to the A + R Model
&lt;/h2&gt;

&lt;p&gt;Both approaches have their &lt;strong&gt;pros&lt;/strong&gt; and &lt;strong&gt;cons&lt;/strong&gt;, but what happens when we combine them? The &lt;strong&gt;A + R model&lt;/strong&gt; takes the best of adaptive and responsive design by introducing the concept of major and minor breakpoints.&lt;/p&gt;

&lt;h3&gt;
  
  
  A for Adaptive
&lt;/h3&gt;

&lt;p&gt;As mentioned earlier, the adaptive approach allows us to tailor experiences, content, and even features based on the type of device or screen size (usually the more appropriate factor). Major breakpoints are defined to mark the start and end of an experience.&lt;/p&gt;

&lt;p&gt;By setting &lt;strong&gt;960px&lt;/strong&gt; as a major breakpoint (&lt;a href="http://gs.statcounter.com/screen-resolution-stats/tablet/worldwide" rel="noopener noreferrer"&gt;based on global stats&lt;/a&gt;), we can imagine something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp03ljbgfarh7i1nov9d.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fdp03ljbgfarh7i1nov9d.jpeg" width="720" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The left side represents screens smaller than 960px, delivering layouts and content tailored to that type of experience.
&lt;/li&gt;
&lt;li&gt;The right side represents screens larger than 960px, offering an experience designed for that type of navigation.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  R for Responsive
&lt;/h3&gt;

&lt;p&gt;The major breakpoint creates two potentially different experiences, within which we can apply responsive design techniques. For each defined experience, we can set minor breakpoints to adapt the layout to the available space. For instance, tablet users might see an experience optimized for touch devices (adaptive), but with layouts that adjust based on device orientation (responsive).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbp3rs6qmi476ibb7cxj2.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbp3rs6qmi476ibb7cxj2.jpeg" width="720" height="480"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Adaptive + Responsive
&lt;/h3&gt;

&lt;p&gt;Combining &lt;strong&gt;Adaptive&lt;/strong&gt; and &lt;strong&gt;Responsive&lt;/strong&gt; approaches results in the &lt;strong&gt;A + R model.&lt;/strong&gt; The adaptive technique defines experiences and functionalities, creating two distinct contexts. Meanwhile, the responsive technique manages interface components, layouts, and behaviors within each context.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fta7t75mtgz4ycedkzkp8.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fta7t75mtgz4ycedkzkp8.jpeg" width="800" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  When to Choose This Model
&lt;/h3&gt;

&lt;p&gt;This approach requires designers and developers to fully understand the experiences they want to deliver. It’s typically used for large applications that need to be optimized for mobile devices, requiring various functionalities and layouts. While it offers flexibility and customization, it also introduces complexity, as you might end up managing two separate projects or environments, which is not recommended.&lt;/p&gt;

&lt;p&gt;If the team decides to follow the A + R model, they can focus on delivering curated, targeted experiences based on user type—something a purely responsive approach cannot achieve, as it’s always a compromise.&lt;/p&gt;

&lt;h3&gt;
  
  
  Who Uses the A + R Model?
&lt;/h3&gt;

&lt;p&gt;Many online services we use daily follow this approach. Twitter, Facebook, and GitHub, for example, provide dedicated mobile apps rather than simply stacking and hiding parts of their desktop content. If you access these services on your mobile device, you’ll notice tailored experiences designed to meet the expectations of mobile users compared to desktop users.&lt;/p&gt;

</description>
      <category>ux</category>
      <category>frontend</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Introducing Native Elements</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Thu, 18 Jun 2020 15:27:08 +0000</pubDate>
      <link>https://dev.to/equinusocio/introducing-native-elements-4j5i</link>
      <guid>https://dev.to/equinusocio/introducing-native-elements-4j5i</guid>
      <description>&lt;p&gt;HTML elements with CSS superpowers. 🔥&lt;/p&gt;

&lt;p&gt;Native Elements (NE) is not a CSS framework, no bundlers required or tons of configurations to set. You can consider it as a customizable plug-n-play library for your site which helps you easily style all the available HTML elements using CSS custom properties, classes, attributes, or whatever you want in less than &lt;code&gt;6 kB&lt;/code&gt;. You can also build your class-based CSS framework on top of it.&lt;/p&gt;




&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;p&gt;This library is built using modern CSS feature and best practices, the compiled version supports only the latest two Chrome, Safari, Firefox, and Edge versions and this is possible thanks to &lt;a href="https://github.com/browserslist/browserslist" rel="noopener noreferrer"&gt;Browserslist&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Modern
&lt;/h3&gt;

&lt;p&gt;Built on top of PostCSS takes advantage of exciting new CSS features, like custom and logical properties. If you use it from source, you can define custom selectors and mixins to make styling even easier.&lt;/p&gt;

&lt;h3&gt;
  
  
  Framework agnostic
&lt;/h3&gt;

&lt;p&gt;In the age of Flexbox, CSS grid, and other exciting layout features, there is less and less need for a bloated CSS framework. What you do need is a simple foundation on top of which to build your styles.&lt;/p&gt;

&lt;p&gt;If you're using the compiled version, just drop it inside your application main style. It's just CSS, so it works with &lt;a href="https://reactjs.org" rel="noopener noreferrer"&gt;React&lt;/a&gt;, &lt;a href="https://vuejs.org/" rel="noopener noreferrer"&gt;Vue&lt;/a&gt;, &lt;a href="https://angular.io/" rel="noopener noreferrer"&gt;Angular&lt;/a&gt; and &lt;a href="https://svelte.dev/" rel="noopener noreferrer"&gt;Svelte.&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Easy theming
&lt;/h3&gt;

&lt;p&gt;With our &lt;a href="https://app.native-elements.dev" rel="noopener noreferrer"&gt;theme builder&lt;/a&gt; tool you can create, tweak, and export your theme easily. In the future, we'll share new premade themes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Making a theme
&lt;/h2&gt;

&lt;p&gt;Thanks to the &lt;a href="https://app.native-elements.dev/" rel="noopener noreferrer"&gt;Theme Builder&lt;/a&gt; app you can create your color palette, visually change and preview all the available custom properties, and download a ready-to-use theme that you can include in your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://app.native-elements.dev/" rel="noopener noreferrer"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fnative-elements.dev%2Fimg%2Ftb.png" width="" height=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Using themes
&lt;/h3&gt;

&lt;p&gt;Once you have your set of custom properties, there few ways to use it. You can put the custom properties inside the global &lt;code&gt;:root&lt;/code&gt; of your css, or scope it inside a custom selectors.&lt;/p&gt;

&lt;h3&gt;
  
  
  Global themes
&lt;/h3&gt;

&lt;p&gt;When you put your theme inside the &lt;code&gt;:root&lt;/code&gt; selector it will be applied to all the elements of your page. This is useful when you have one theme active at time:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;220&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-root-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.125rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-selection-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-selection-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;233&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;72&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-outline-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-outline-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-basic-line-height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-headings-scale&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.25&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-quote-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-cite-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-cite-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-cite-start-sign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'—'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-links-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-links-active-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;233&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;64&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;52&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-del-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;337&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;74&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;31&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-del-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;94&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Scoped themes
&lt;/h3&gt;

&lt;p&gt;The CSS's cascade is very useful to make scoped themes, it affects custom properties like other properties.&lt;/p&gt;

&lt;p&gt;If you want to divide your theme into multiple pieces, you can wrap the custom properties inside separate selectors. Every element inside that selector will inherit the theme, while elements outside it will use their default style.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;220&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-root-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.125rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.NeumorphicTheme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;220&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-root-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--ne-body-font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;1.125rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="cm"&gt;/* ... */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  When to use it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;You're working on projects for &lt;strong&gt;modern and secure web browsers&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;You're not going to mix other CSS frameworks&lt;/li&gt;
&lt;li&gt;You want to save time sacrificing a bit of flexibility.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  More on &lt;a href="https://native-elements.dev" rel="noopener noreferrer"&gt;native-elements.dev&lt;/a&gt;
&lt;/h2&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Making dark theme switcher with PostCSS.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Tue, 12 May 2020 08:17:24 +0000</pubDate>
      <link>https://dev.to/equinusocio/making-dark-theme-switcher-with-postcss-187i</link>
      <guid>https://dev.to/equinusocio/making-dark-theme-switcher-with-postcss-187i</guid>
      <description>&lt;p&gt;You have noticed that there is a new design trend that is floating around web design since 2019, the dark mode. Facebook, Apple, and Google both introduced the dark version of their software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a dark theme
&lt;/h2&gt;

&lt;p&gt;Most of you probably think this is just a trend that will disappear after some years, well, let me say that this is not like many other trends, dark UI provide different advantages and they are not something just related to the "designer mood". Let's see why a dark mode on your applications and websites are something useful.&lt;/p&gt;

&lt;h3&gt;
  
  
  Better for batteries
&lt;/h3&gt;

&lt;p&gt;Pixels on a screen consume more energy to display light colors rather than dark ones. Consequently, devices' batteries can save energy and improve their daily duration while using dark UI.&lt;/p&gt;

&lt;h3&gt;
  
  
  Better for dark environments
&lt;/h3&gt;

&lt;p&gt;Most of us use their smartphone and laptops while at home. Such environments are typically not so bright. The dark mode can help the use of the application while indoor, without causing visual disturbances.&lt;/p&gt;

&lt;h3&gt;
  
  
  Better for people
&lt;/h3&gt;

&lt;p&gt;Some people with — or without — visual diseases, like epilepsy, can have unfortunate events by being flashed by bright applications. Having a dark mode means being more accessible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Preparing styles
&lt;/h2&gt;

&lt;p&gt;A very simple theme switcher should offer at least 3 options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Dark theme&lt;/li&gt;
&lt;li&gt;Light theme&lt;/li&gt;
&lt;li&gt;Automatic theme (should be on by default)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Wait, what's the automatic theme? Well, modern operating systems allow users to change the global visual appearance by setting os-wide options that enable the dark or light mode. The automatic option make sure to respect the OS preference if the user has not specified any theme.&lt;/p&gt;

&lt;p&gt;To make this even more simple, we'll use PostCSS and a simple but useful plugin called &lt;a href="https://github.com/postcss/postcss-dark-theme-class" rel="noopener noreferrer"&gt;&lt;code&gt;postcss-dark-theme-class&lt;/code&gt;&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add postcss-dark-theme-class
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;This plugin will do 70% of the work, once installed, add it to your PostCSS config and configure the selectors you want to use to activate the correct theme, which will be used by the plugin to generate the correct CSS:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;module&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;exports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="cm"&gt;/* ...other plugins */&lt;/span&gt;

    &lt;span class="nb"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'postcss-dark-theme-class'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;darkSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'[data-theme="dark"]'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;lightSelector&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'[data-theme="light"]'&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Once the plugin is up and running, we can start defining our dark and light themes using a CSS specific media query &lt;code&gt;prefers-color-scheme&lt;/code&gt;. This special media query will handle the automatic part of our themes by applying the correct theme based on the user's OS preferences:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;If the user is using a dark version of his OS, the set inside the media query will apply, overwriting others, otherwhise the set of properties outside the media query is used. Since it's pure CSS, this behaviour is on by default.&lt;/p&gt;

&lt;p&gt;Browsers will now adapt the color scheme automatically based on the users' OS preferences. Nice done! 🚀 Now it's time to make the theme switcher allow users to specify what theme to use, overriding the OS preference.&lt;/p&gt;
&lt;h2&gt;
  
  
  Making the theme switcher
&lt;/h2&gt;

&lt;p&gt;As we said, our switcher should have three options, we can use a simple select element, or build a set of buttons:&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;data-set-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"auto"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Auto&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;data-set-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"dark"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Dark&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;data-set-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"light"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Light&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;We'll build the switcher using vanilla JS, but you can do it with any framework you want, the concept is the same: we have to add the selectors we defined inside the PostCSS plugin to the &lt;code&gt;root&lt;/code&gt; element, based on the clicked button.&lt;br&gt;
&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;html&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;documentElement&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;themeButtons&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;querySelectorAll&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'[data-set-theme]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="n"&gt;themeButtons&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;forEach&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;setTheme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;button&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'click'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;html&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;dataset&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Each time we click on a theme button, the value set as &lt;code&gt;data-set-theme&lt;/code&gt; is applied as value of the &lt;code&gt;data-theme&lt;/code&gt; attribute on the document root element, we also change the &lt;code&gt;[aria-current]&lt;/code&gt; attribute.&lt;/p&gt;

&lt;p&gt;Check it live:&lt;/p&gt;


&lt;div class="glitch-embed-wrap"&gt;
  &lt;iframe width="100%" height="450" sandbox="allow-same-origin allow-scripts allow-forms allow-top-navigation-by-user-activation allow-popups" src="https://glitch.com/embed/#!/embed/theme-switcher-with-postcss?path=index.html" alt="theme-switcher-with-postcss on glitch"&gt;&lt;/iframe&gt;
&lt;/div&gt;



&lt;h2&gt;
  
  
  Where is the magic?
&lt;/h2&gt;

&lt;p&gt;The magic is made by &lt;code&gt;postcss-dark-theme-class&lt;/code&gt; — which will add our &lt;code&gt;[data-theme]&lt;/code&gt; custom attribute to the &lt;code&gt;:root&lt;/code&gt; selectors we wrote — during the CSS transpilation. Here what it generates from our code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* Our automatic and user specified light theme */&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/* Our automatic dark theme */&lt;/span&gt;
&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nl"&gt;root&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nf"&gt;not&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;data-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"light"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="cm"&gt;/* Our dark theme specified by the user */&lt;/span&gt;
&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"dark"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Bonus tip
&lt;/h2&gt;

&lt;p&gt;You may notice that the &lt;code&gt;--accent-color&lt;/code&gt; custom property defined inside themes doesn't change. If you have colors that will not change based on the theme, you can remove them from the &lt;code&gt;prefers-color-scheme&lt;/code&gt; at-rule.&lt;/p&gt;

&lt;p&gt;In this way, they will not be duplicated and the one defined outside the media query will always apply.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="nt"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nv"&gt;--accent-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;226deg&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nt"&gt;prefers-color-scheme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;dark&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nv"&gt;--global-background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nv"&gt;--global-foreground&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;hsl&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>css</category>
      <category>a11y</category>
      <category>html</category>
      <category>customproperties</category>
    </item>
    <item>
      <title>Making Web Components for Different Contexts</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Tue, 07 May 2019 14:08:48 +0000</pubDate>
      <link>https://dev.to/equinusocio/making-web-components-for-different-contexts-25ed</link>
      <guid>https://dev.to/equinusocio/making-web-components-for-different-contexts-25ed</guid>
      <description>&lt;p&gt;This article isn’t about how to build web components. Caleb Williams already wrote a &lt;a href="https://css-tricks.com/an-introduction-to-web-components/" rel="noopener noreferrer"&gt;comprehensive guide&lt;/a&gt; about that recently. Let’s talk about how to work with them, what to consider when making them, and how to embrace them in your projects.&lt;/p&gt;

&lt;p&gt;If you are new to web components, Caleb’s guide is a great read, but here are more resources that will get you up to speed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://equinsuocha.io/blog/web-components-the-right-way" rel="noopener noreferrer"&gt;Web Components — the "right" way&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developers.google.com/web/fundamentals/web-components/shadowdom" rel="noopener noreferrer"&gt;Shadow DOM v1: Self-Contained Web Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components" rel="noopener noreferrer"&gt;Web Components on MDN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/mateusortiz/webcomponents-the-right-way" rel="noopener noreferrer"&gt;Awesome Web Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://open-wc.org/" rel="noopener noreferrer"&gt;Open Web Component Recommendations&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Since web components are now &lt;a href="https://caniuse.com/#search=shadow" rel="noopener noreferrer"&gt;widely supported&lt;/a&gt; (thanks to the hard work of many people behind the scenes) — and considering the &lt;a href="https://css-tricks.com/edge-goes-chromium-what-does-it-mean-for-front-end-developers/" rel="noopener noreferrer"&gt;imminent switch&lt;/a&gt; that Edge will make to the chromium platform — people are now thinking about web components as "native" and a platform-compliant way to build reusable UI components to keep consistency across design systems and web projects, while using the power of the Shadow DOM to encapsulate style and logics inside the component itself.&lt;/p&gt;

&lt;p&gt;Well, this can be true and false at the same time. But first, let’s get acquainted with the &lt;strong&gt;Abstraction Layers Triangle&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Abstraction Layers Triangle
&lt;/h2&gt;

&lt;p&gt;Technically, we should consider web components as an extension of our favorite markup language, HTML (yep!). The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components" rel="noopener noreferrer"&gt;Web Components API&lt;/a&gt; allows us to create custom HTML elements (e.g. &lt;code&gt;&amp;lt;foo-bar&amp;gt;&lt;/code&gt;) that don’t exist in HTML.&lt;/p&gt;

&lt;p&gt;We are told web components are basically new HTML elements, so we should consider them as part of the HTML specifications and, consequently, we should follow its paradigms, core concepts, and utilisation. If we assume all of these points, we will figure out that our components will live among the lowest levels of the web platform stack, alongside HTML, CSS, and JavaScript.&lt;/p&gt;

&lt;p&gt;Frameworks and libraries like React, Vue, Angular, SvelteJS work on their abstraction level, right above other tools that live in a sort of "middle earth," like StencilJs, Hybrids and Lit. Under these layers of abstraction, we can find our basic web technologies… and vanilla web components. We can represent this concept with an &lt;strong&gt;ALT&lt;/strong&gt; (&lt;strong&gt;A&lt;/strong&gt;bstraction &lt;strong&gt;L&lt;/strong&gt;ayers &lt;strong&gt;T&lt;/strong&gt;riangle) diagram:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcss-tricks.com%2Fwp-content%2Fuploads%2F2019%2F04%2Fs_5B36036EA3CCD2962258CADABD44B400D52827409ACCBE3D636781BACC2B8EDC_1554105948178_al.svg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fcss-tricks.com%2Fwp-content%2Fuploads%2F2019%2F04%2Fs_5B36036EA3CCD2962258CADABD44B400D52827409ACCBE3D636781BACC2B8EDC_1554105948178_al.svg" alt="ALT" width="739" height="460"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Why is this important? Well, it helps us visualise the various layers that exist on top of native components and understand the context they are used so that they can be built for an intended context. What's context? That's where we're headed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Same technology, different contexts
&lt;/h2&gt;

&lt;p&gt;The Shadow DOM is a key factor in the Web Components API. It allows us to bundle JavaScript and CSS inside a custom element to both prevent external interferences and style manipulations, unless we expressly allow it. There are indeed some approaches that developers can follow to allow external CSS to leak into the shadow root and into a component, including custom properties and the &lt;code&gt;::part&lt;/code&gt; and &lt;code&gt;::theme&lt;/code&gt; pseudo-elements, which is something &lt;a href="https://twitter.com/notwaldorf" rel="noopener noreferrer"&gt;Monica Dinculescu&lt;/a&gt;) has &lt;a href="https://meowni.ca/posts/part-theme-explainer/" rel="noopener noreferrer"&gt;covered so well&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;There is also another thing to consider: the context we are working with. After three years of building web components personally, I can identify two contexts: the &lt;strong&gt;private context&lt;/strong&gt; (like a design system) and the &lt;strong&gt;standard context&lt;/strong&gt; (like plain HTML, CSS, and JavaScript without custom styles).&lt;/p&gt;

&lt;p&gt;Before designing components, we need to know how they will be used, so determining the type of context is a key to all of this. The most easy way is targeting only one context, but with a small CSS trick. we can build our components for both of them.&lt;/p&gt;

&lt;p&gt;Let’s look at the differences between the two contexts before we get into that.&lt;/p&gt;

&lt;h3&gt;
  
  
  Private context
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;private context&lt;/strong&gt; is a closed ecosystem that provides components with their own style that must be used as-is. So, if we are building a component library that comes from specific styling guidelines or a design system, each component will reflect custom styles so there’s no need to code them up each time they’re needed.&lt;/p&gt;

&lt;p&gt;That can be true also with JavaScript logic. For example, we can attach a closed shadow root that prevent others to accidentally pierce the shadow boundary with a &lt;code&gt;querySelector&lt;/code&gt;. As a a result, we can simply pick and use all any component, avoiding issues like style inconsistencies and CSS collisions. As the author, you can also get to define a set of CSS custom properties (or &lt;code&gt;::parts&lt;/code&gt;) that can be used to style a component for a specific use case, but this is not the focus point of a design system.&lt;/p&gt;

&lt;p&gt;Here’s an example of a web component component in a private context. It has all of the styles and logic contained inside its &lt;code&gt;shadow-root&lt;/code&gt; and and can simply be dropped into any page.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/equinusocio/embed/WWbQdP?height=600&amp;amp;default-tab=html,result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This example and the one to follow are for demonstration purposes and not intended for production use because they do not make considerations for key situations, like accessibility and other optimisations.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Components in a private context can be rarely used outside of that context. For example, if we try to take an element from a design system (which has its own enforced styles), we’re unable to simply add it to a project and expect to customise it. You know how Bootstrap can be themed and customised to your liking? This is pretty much the opposite of that. These components are made to live inside their context and their context only.&lt;/p&gt;

&lt;h3&gt;
  
  
  Standard context
&lt;/h3&gt;

&lt;p&gt;A &lt;strong&gt;standard&lt;/strong&gt; context may be the most complex type of component, not only because the environment can range anywhere from a full-fledged framework (like Vue and React) to plain vanilla HTML, but also because everyone should be able to use that component like any other element.&lt;/p&gt;

&lt;p&gt;For example, when adding a component publicly, say to npm, those who use it will expect to be able to customise it, at least to some degree.&lt;/p&gt;

&lt;p&gt;Do you know of any HTML element that comes with its own presentational style? The answer should be no because, well, elements must be explicitly styled with CSS. This is also true for web components made in a standard context. A single web component should be customisable by adding classes an attributes, or other methods.&lt;/p&gt;

&lt;p&gt;Here’s the same &lt;code&gt;&amp;lt;todo-list&amp;gt;&lt;/code&gt; element that we saw in the closed context example, but designed for a standard context. It works as-is, without any presentational styles inside its shadow root. In fact, it only contains the required logic and baseline CSS to make sure it functions. Otherwise, it’s completely customisable like any standard HTML element, like a div.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/equinusocio/embed/vMOqBO?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Both of the examples we’ve looked at for each context are made with the same component. The difference is that the component in a standard context an be customised and selected with external CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web components and composition
&lt;/h2&gt;

&lt;p&gt;OK, so working with web components is really the same as working with plain HTML, though as we’ve seen, it’s important to follow the paradigms and principles of the given content. Well, thing we need to be mindful of is the web component composition.&lt;/p&gt;

&lt;p&gt;As explained by &lt;a href="https://developers.google.com/web/fundamentals/web-components/shadowdom#composition_slot" rel="noopener noreferrer"&gt;Google Web Fundamentals&lt;/a&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Composition is one of the least understood features of shadow DOM, but it's arguably the most important.&lt;/p&gt;

&lt;p&gt;In our world of web development, composition is how we construct apps, declaratively out of HTML. Different building blocks (&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s, &lt;code&gt;&amp;lt;header&amp;gt;&lt;/code&gt;s, &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt;s, &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt;s) come together to form apps. Some of these tags even work with each other. Composition is why native elements like &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt;, and &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; are so flexible. Each of those tags accepts certain HTML as children and does something special with them. For example, &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; knows how to render &lt;code&gt;&amp;lt;option&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;optgroup&amp;gt;&lt;/code&gt; into dropdown and multi-select widgets. The &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; element renders &lt;code&gt;&amp;lt;summary&amp;gt;&lt;/code&gt; as an expandable arrow. Even &lt;code&gt;&amp;lt;video&amp;gt;&lt;/code&gt; knows how to deal with certain children: &lt;code&gt;&amp;lt;source&amp;gt;&lt;/code&gt; elements don't get rendered, but they do affect the video's behavior. What magic!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Composition is what we normally do when we work with HTML. Since web components are merely HTML elements with a DOM reference — and not logical containers — we should rely on composition to build our components and any sub-components. If you think about the &lt;code&gt;ul&lt;/code&gt; and and &lt;code&gt;select&lt;/code&gt; you will notice that you declaratively compose these elements to get the final output and you have specific attributes to be used with the main component (e.g. &lt;code&gt;[readonly]&lt;/code&gt;) or the sub-component (e.g. &lt;code&gt;[selected]&lt;/code&gt;). This is true also for web components, and if you are building a custom list, consider to build the main component (&lt;code&gt;&amp;lt;custom-list&amp;gt;&lt;/code&gt;) and the child one (&lt;code&gt;&amp;lt;custom-li&amp;gt;&lt;/code&gt;). &lt;a href="https://css-tricks.com/extracting-text-from-content-using-html-slot-html-template-and-shadow-dom/" rel="noopener noreferrer"&gt;Using the &lt;code&gt;[slot]&lt;/code&gt; element&lt;/a&gt;, you can define where children elements will be placed and also placeholder content that will be shown when no children are passed through.&lt;/p&gt;

&lt;h2&gt;
  
  
  Web components and accessibility
&lt;/h2&gt;

&lt;p&gt;Another thing to consider is that "small" topic we call accessibility. Since we are creating completely new HTML elements, we need to consider the accessibility of our elements in order to provide a basic semantic role, any keyboard navigation as well as the user’s operating system preferences, like the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-reduced-motion" rel="noopener noreferrer"&gt;reduce motion&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media/-ms-high-contrast" rel="noopener noreferrer"&gt;high contrast&lt;/a&gt; settings.&lt;/p&gt;

&lt;p&gt;I strongly suggest the following resources as reference for building accessible and inclusive components, how to define semantic markup, and how to implement a basic keyboard navigation.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://inclusive-components.design/" rel="noopener noreferrer"&gt;Inclusive Components&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/accessible" rel="noopener noreferrer"&gt;Accessible to All on web.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.w3.org/TR/wai-aria-practices-1.2/" rel="noopener noreferrer"&gt;WAI-ARIA Authoring Practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://webaim.org/standards/wcag/checklist" rel="noopener noreferrer"&gt;WebAIM WCAG Checklist&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Web components are an emerging technology in web development and, as such, there really aren’t any clearly defined best practices to guide us as far as building them for their intended or maximized use. When you find yourself working with them, perhaps the single thing you can take away from this post is to consider whether they are intended for a closed context or a standard context, then ask yourself &lt;strong&gt;WHI&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;W&lt;/strong&gt;ho will use this component?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;H&lt;/strong&gt;ow much flexibility should that person have to customize it?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;I&lt;/strong&gt;s this component for everyone or for a specific audience?&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webcomponents</category>
      <category>html</category>
      <category>showdev</category>
      <category>webdev</category>
    </item>
    <item>
      <title>The Adaptive + Responsive model</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Tue, 12 Feb 2019 15:26:33 +0000</pubDate>
      <link>https://dev.to/equinusocio/the-adaptive--responsive-model-45mn</link>
      <guid>https://dev.to/equinusocio/the-adaptive--responsive-model-45mn</guid>
      <description>&lt;p&gt;You can call it &lt;strong&gt;Adansive&lt;/strong&gt; or &lt;strong&gt;Resaptive&lt;/strong&gt;..&lt;/p&gt;

&lt;p&gt;Responsive and Adaptive design are two design methodologies with the goal of making a product accessible on any device or screen size, providing the best experience to all users. Both of them try to make the most of the available screen space and the user interaction mode. Before talking about the &lt;strong&gt;A+R&lt;/strong&gt; model we need to break down both methodologies approaches &lt;/p&gt;

&lt;p&gt;While &lt;strong&gt;responsive&lt;/strong&gt; design makes use of CSS and/or JS to adapt layouts and contents based on predefined breakpoints, the &lt;strong&gt;adaptive&lt;/strong&gt; approach provides pre-structured templates that will be served based on the user agent and the device type. The main difference between them is the DOM structure, when approaching with a responsive mindset we have the same HTML code for all situations (unless you use JS to remove some DOM nodes), while in adaptive we have a different code structure and potentially different experiences.&lt;/p&gt;

&lt;p&gt;Both design mindsets are valid, just ask yourself how many components and complexities you have in your project and if one experience can fit all of your users. Developing web applications the responsive design is frequently used, such as building specific experiences through an adaptive development, like Twitter and Facebook mobile do.&lt;/p&gt;

&lt;h2&gt;
  
  
  Responsive Design Techniques
&lt;/h2&gt;

&lt;p&gt;While building a responsive experience we have three approaches to handle our layouts and content:&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Reflow&lt;/strong&gt;: We can change the layout structure to better fit the viewport area. Most of time this results in content being stacked (that's not always good).&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/65UW1zPCu13qSmdatPZlhS/601e3a5f2bdc5ba347f3d08c45317235/5c61879965585.gif" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/65UW1zPCu13qSmdatPZlhS/601e3a5f2bdc5ba347f3d08c45317235/5c61879965585.gif" alt="5c61879965585"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Resize:&lt;/strong&gt; Some of the UI components are fluid like most of html elements. They fill the available space and reflow if necessary.&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/3958w8EeBmawW9fxqZXfUC/b008d45133ac7f03b1eb8e927f4f05e4/5c618ef61271a.gif" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/3958w8EeBmawW9fxqZXfUC/b008d45133ac7f03b1eb8e927f4f05e4/5c618ef61271a.gif" alt="5c618ef61271a"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Show/Hide:&lt;/strong&gt; Some UI parts are hidden from the viewport (but they still exist) or showed up to fill the space.&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/7ECGrNclFOLOYPO12yNlOa/6cd743d8e07ad6238462fdef2423d5f0/5c629b5ec96d8.gif" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/7ECGrNclFOLOYPO12yNlOa/6cd743d8e07ad6238462fdef2423d5f0/5c629b5ec96d8.gif" alt="5c629b5ec96d8"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Restructuring:&lt;/strong&gt; With this approach we can develop and deliver different layouts to provide the best experience for a specific environment like a touch-only mobile device, or hybrid-touch devices.&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/3Ykv98R1ejIg0AFGzmjfsB/1ecefef84320cf91b81486556dbce506/5c619176816f9.png" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/3Ykv98R1ejIg0AFGzmjfsB/1ecefef84320cf91b81486556dbce506/5c619176816f9.png" alt="5c619176816f9"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing the A+R model
&lt;/h2&gt;

&lt;p&gt;Both approaches have pro and cons, but what do we get if we want to use both of them? The &lt;strong&gt;A+R&lt;/strong&gt; model combines both the responsive and adaptive approaches based on a single major breakpoint. &lt;/p&gt;

&lt;h3&gt;
  
  
  &amp;nbsp;A stands for Adaptive
&lt;/h3&gt;

&lt;p&gt;As mentioned above, the adaptive approach allows us to differentiate the user experience, contents and even functionalities based on the user device. Considering a &lt;strong&gt;960px&lt;/strong&gt; as major adaptive breakpoint (&lt;a href="http://gs.statcounter.com/screen-resolution-stats/tablet/worldwide" rel="noopener noreferrer"&gt;defined based on global stats&lt;/a&gt;), we have something similar: &lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/5qvXnLZ4VK7rAko5IWQ0VP/e2b53e5dd86381b7eb05b8c3afb03e0a/5c61a09419d77.png" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/5qvXnLZ4VK7rAko5IWQ0VP/e2b53e5dd86381b7eb05b8c3afb03e0a/5c61a09419d77.png" alt="5c61a09419d77"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The viewport area on the left represent all the screens under a 960px  with a specific layout/content&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The viewport area on the right represent all the screens with a 960px or greater with another layout.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  R stands for Responsive
&lt;/h3&gt;

&lt;p&gt;The major breakpoint we have defined create two exprience contexts that may be different from each other, in which we can apply the responsive techniques. Inside each experience we can define minor breakpoints to adapt the layout based on the available space. For example, users which use a tablet will may see a touch-optimised experience (adaptive), but we can still adapt the layout based on the device orientation (responsive).&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/41vr70gcIuTyC12VMlrrSC/1594a240a1a6bf171ce87b19608c38df/5c62a707337cd.png" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/41vr70gcIuTyC12VMlrrSC/1594a240a1a6bf171ce87b19608c38df/5c62a707337cd.png" alt="5c62a707337cd"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Adaptive + Responsive
&lt;/h2&gt;

&lt;p&gt;Combining Adaptive and Responsive approaches we get the &lt;strong&gt;A + R model&lt;/strong&gt;. With the adaptive technique we will work on experiences and functionalities, making two different contexts. Withe the responsive one we handle the UI components and layouts which stand inside the contexts.&lt;/p&gt;

&lt;p&gt;&lt;a href="//images.ctfassets.net/gz0sygvqczyz/4IfXMr6udDCdhGge4E0JTz/6daae93d3abbbe04b6184e76f84156d6/5c62a992ae5af.png" class="article-body-image-wrapper"&gt;&lt;img src="//images.ctfassets.net/gz0sygvqczyz/4IfXMr6udDCdhGge4E0JTz/6daae93d3abbbe04b6184e76f84156d6/5c62a992ae5af.png" alt="5c62a992ae5af"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  When to choose the A + R model
&lt;/h2&gt;

&lt;p&gt;This design approach require designers to really understand the experiences they want to provide in order to define what model to follow. This model fit well for large applications that must be accessible from small mobile devices with less functionalities or with a completely different structure. As you can see you will get a lot of flexibility, but also complexity because you may have to handle different codebases and environments (not mandatory).&lt;/p&gt;

&lt;p&gt;With the A+R model mindset, designers and developers (but also product owners) can be focused to improve all the experiences the product can offers, instead to provide a "good" experience only on one environment.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://equinsuocha.io/blog/the-adaptive-responsive-model" rel="noopener noreferrer"&gt;equinsuocha.io&lt;/a&gt;. All the images are made by me and the Contactlab UX team.&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>ux</category>
      <category>showdev</category>
    </item>
    <item>
      <title>Fieldset, this stranger.</title>
      <dc:creator>Mattia Astorino</dc:creator>
      <pubDate>Fri, 08 Feb 2019 18:21:32 +0000</pubDate>
      <link>https://dev.to/equinusocio/fieldset-this-stranger-55pf</link>
      <guid>https://dev.to/equinusocio/fieldset-this-stranger-55pf</guid>
      <description>&lt;p&gt;Field..wat?? Yep, it still exist but no one seems to remember it. This guy is a &lt;a href="https://html.spec.whatwg.org/multipage/form-elements.html#the-fieldset-element" rel="noopener noreferrer"&gt;living standard form element&lt;/a&gt; that is made to represent a set of elements inside a form or grouping related elements like labels, inputs, meters, paragraphs etc... and it doesn't end here, it can be nested and can contains any kind of elements.&lt;/p&gt;

&lt;p&gt;Are you still interested? So i will tell you two more things, it can also accept three really useful html attributes that will help you making your beautiful forms aaaand....it's not made to wrap only radio buttons! 😱&lt;/p&gt;

&lt;h2&gt;
  
  
  The specification
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;The fieldset element represents a set of form controls (&lt;em&gt;or other content&lt;/em&gt;) grouped together, optionally with a caption. The caption is given by the first &lt;a href="https://html.spec.whatwg.org/multipage/form-elements.html#the-legend-element" rel="noopener noreferrer"&gt;legend&lt;/a&gt; element that is a child of the fieldset element, &lt;em&gt;if any&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;— &lt;a href="https://html.spec.whatwg.org/multipage/form-elements.html#the-fieldset-element" rel="noopener noreferrer"&gt;WHATWG&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It's pretty clear what you should do with this element and when using it. As mentioned above it can also accept three attributes: &lt;code&gt;form&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt; and &lt;code&gt;disabled&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FORM&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This attribute allows you to associate a group of inputs to a specific form element that is not its ancestor. This means that you can fix the lack of the possibility to nest forms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;NAME&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The name of the group to use in the &lt;a href="https://html.spec.whatwg.org/multipage/forms.html#dom-form-elements" rel="noopener noreferrer"&gt;form.elements&lt;/a&gt; API&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;DISABLED&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the same global attribute you use on buttons and inputs. It disable at once all the child elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  A use case
&lt;/h2&gt;

&lt;p&gt;Let's take a real example making a form with disabled sections controlled by checkboxes. In this form we will use label, inputs and the output element and we can build it by making the most of fieldset attributes and a bit of javascript.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"calculatorForm"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;fieldset&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"checkbox"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"enableCalc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"enableCalc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Enable calc&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"calculator"&lt;/span&gt; &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- Default formula --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"defaultcalc"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"checkbox"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"default"&lt;/span&gt; &lt;span class="na"&gt;checked&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"default"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Use default calculation&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;

    &lt;span class="c"&gt;&amp;lt;!-- Custom formula --&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"customcalc"&lt;/span&gt; &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;label&amp;gt;&lt;/span&gt;Use custom calculation&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
      &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"c"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;+
      &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"number"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"50"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"d"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;=
      &lt;span class="nt"&gt;&amp;lt;output&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"x"&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"c d"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;100&lt;span class="nt"&gt;&amp;lt;/output&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example we have a form with a fieldset named "calculator" which is disabled by default. When clicking the &lt;code&gt;enableCalc&lt;/code&gt;checkbox the calculator area will be enabled. Here the live demo.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://jsfiddle.net/equinusocio/2fm4Lksc/embedded/result,html//dark" width="100%" height="600"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Apart the javascript integration, the point here is &lt;code&gt;fieldset&lt;/code&gt; element. It's live, it's standard and it's useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  "Bad" examples from...
&lt;/h2&gt;

&lt;p&gt;The following examples are neither wrong or correct, but why not break this loop of "not-so-good practices" and start improving our code the same way we iper-improve our javascript code?&lt;/p&gt;

&lt;h3&gt;
  
  
  Twitter Bootstrap
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"form-group"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"formGroupExampleInput"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Example label&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"form-control"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"formGroupExampleInput"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  ZURB Foundation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"input-group"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"input-group-field"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"url"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"input-group-button"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"button"&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Material Design Components
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mdc-form-field"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mdc-checkbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"checkbox"&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"my-checkbox"&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mdc-checkbox__native-control"&lt;/span&gt;&lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mdc-checkbox__background"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
      ...
    &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"my-checkbox"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;This is my checkbox&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Tailwind CSS
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mb-4"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"block text-grey-darker"&lt;/span&gt; &lt;span class="na"&gt;for&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Username&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;placeholder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Username"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As you can see many popular frameworks don't use fieldset (bootstrap mention it but nothing more) as form elements container and that's really weird because HTML have all the tools we need to build our webpages and applications. We should not recreate what the platform already provide, instead we just need to learn it and eventually how to extend it, for example with &lt;a href="https://equinsuocha.io/blog/web-components-the-right-way" rel="noopener noreferrer"&gt;web components&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>javascript</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
