<?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: Marco Schulz</title>
    <description>The latest articles on DEV Community by Marco Schulz (@marcoschulz123).</description>
    <link>https://dev.to/marcoschulz123</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%2F4220452%2Fd28c3ba2-cf81-402e-9d66-666616d9d8bb.jpg</url>
      <title>DEV Community: Marco Schulz</title>
      <link>https://dev.to/marcoschulz123</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/marcoschulz123"/>
    <language>en</language>
    <item>
      <title>Property listing card in React with saved homes</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Fri, 20 Nov 2026 14:00:06 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/property-listing-card-in-react-with-saved-homes-477e</link>
      <guid>https://dev.to/marcoschulz123/property-listing-card-in-react-with-saved-homes-477e</guid>
      <description>&lt;p&gt;The listing card is the most repeated element on any real estate site. A search results page renders it twenty times, a home page six times, an agent page four. Whatever is wrong with it is wrong everywhere at once, which is why I spend more time on this one component than on any hero. The &lt;a href="https://dev.to/components/property-card"&gt;Property card&lt;/a&gt; in Facade is free and MIT licensed, and this article walks through its anatomy and the decisions behind each part.&lt;/p&gt;

&lt;h2&gt;
  
  
  Card anatomy
&lt;/h2&gt;

&lt;p&gt;Top to bottom, a listing card has five zones:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The photo, with a fixed aspect ratio so a grid of cards lines up&lt;/li&gt;
&lt;li&gt;A status badge in the photo's top left corner&lt;/li&gt;
&lt;li&gt;A save heart in the top right&lt;/li&gt;
&lt;li&gt;Price, then address and city&lt;/li&gt;
&lt;li&gt;Beds, baths and square footage in a row with icons&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The order is the order buyers read. Photo first, because they are deciding whether to look at all. Price second, because it is the filter. Address third, because it tells them the neighborhood. The facts row last, because it confirms or kills the interest the first three created.&lt;/p&gt;

&lt;p&gt;The whole card is a &lt;code&gt;motion.article&lt;/code&gt;. On hover it lifts by two pixels and the photo scales up by four percent inside its clipped container, both of which are skipped when the visitor prefers reduced motion. The address is the link: when you pass &lt;code&gt;href&lt;/code&gt;, it renders as an anchor with a pseudo element that covers the entire card, so the full card is clickable while the heart button stays a separate, nested-free control on top.&lt;/p&gt;

&lt;h2&gt;
  
  
  The status badge
&lt;/h2&gt;

&lt;p&gt;Status is a small union type, not a free string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;PropertyStatus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"for-sale"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"pending"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"new"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Each value maps to a label and a style. "For sale" and "Pending" sit on a translucent background over the photo. "New" uses the brand color, because new listings are the ones a returning visitor is scanning for. Keeping the union small is deliberate; the moment status accepts any string, the grid ends up with "Active", "ACTIVE" and "active" rendering three different ways.&lt;/p&gt;

&lt;h2&gt;
  
  
  The saved heart
&lt;/h2&gt;

&lt;p&gt;The heart is a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; with &lt;code&gt;aria-pressed&lt;/code&gt; and a label that flips between "Save home" and "Remove from saved homes." When it toggles, the icon re-mounts with a spring from a smaller scale, and a ring expands outward and fades, the way a like button does on a social app. The ring only renders when the home is being saved and the visitor has not asked for reduced motion.&lt;/p&gt;

&lt;p&gt;State is simple: &lt;code&gt;defaultFavorite&lt;/code&gt; seeds it and &lt;code&gt;onFavoriteChange&lt;/code&gt; reports every toggle. The card does not persist anything itself. Persistence belongs to the page, because the page knows whether the visitor is logged in, what the storage key should be and whether saved homes sync to an account.&lt;/p&gt;

&lt;p&gt;For an anonymous visitor, &lt;code&gt;localStorage&lt;/code&gt; is enough:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="s2"&gt;"use client"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"react"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;PropertyCard&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/property-card"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;KEY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"saved-homes"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;useSavedHomes&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;setSaved&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;useState&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kt"&gt;string&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="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="nf"&gt;useEffect&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="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nf"&gt;setSaved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;parse&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&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="k"&gt;catch&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;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="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;toggle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nf"&gt;setSaved&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&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;next&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;on&lt;/span&gt; &lt;span class="o"&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="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Set&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;span class="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;id&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="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;localStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="no"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;next&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="k"&gt;catch&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;next&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;toggle&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;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;ListingCard&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;id&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="n"&gt;listing&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;beds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;baths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;sqft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;src&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;toggle&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSavedHomes&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;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PropertyCard&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="n"&gt;listing&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"new"&lt;/span&gt;
      &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="sb"&gt;`/homes/${id}`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;defaultFavorite&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
      &lt;span class="n"&gt;onFavoriteChange&lt;/span&gt;&lt;span class="o"&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;on&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;toggle&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;on&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="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;Read storage in an effect, not during render, or the server and the client disagree on the first paint and React warns about a hydration mismatch. Wrap the storage calls in &lt;code&gt;try&lt;/code&gt; because private browsing modes and some embedded browsers throw on access.&lt;/p&gt;

&lt;h2&gt;
  
  
  Price and area formatting with Intl
&lt;/h2&gt;

&lt;p&gt;Never build a price string by hand. &lt;code&gt;"$" + price&lt;/code&gt; gives you &lt;code&gt;$1250000&lt;/code&gt;, which a buyer has to count the zeros of. The card uses &lt;code&gt;Intl.NumberFormat&lt;/code&gt; with &lt;code&gt;style: "currency"&lt;/code&gt; and zero fraction digits, so the output is &lt;code&gt;$1,250,000&lt;/code&gt;. Square footage goes through &lt;code&gt;toLocaleString("en-US")&lt;/code&gt; for the thousands separator. For rentals, &lt;code&gt;priceSuffix="/mo"&lt;/code&gt; appends a muted suffix after the formatted price.&lt;/p&gt;

&lt;p&gt;The same thinking applies to the facts strip on a listing detail page. The &lt;a href="https://dev.to/components/key-facts"&gt;Key facts&lt;/a&gt; component takes an array of facts and counts each number up when it scrolls into view. It handles the two cases that trip up a naive counter: compact notation, so a list price counts up as &lt;code&gt;$1.25M&lt;/code&gt; instead of a seven digit blur, and &lt;code&gt;noGrouping&lt;/code&gt; for a year built, so 2019 does not render as 2,019. For the year it also starts the count from 97 percent of the target instead of zero, because watching 0 climb to 2019 is silly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;KeyFacts&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;KeyFact&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/key-facts"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;DollarSign&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;BedDouble&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Bath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Ruler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Calendar&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"lucide-react"&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;facts&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;KeyFact&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"List price"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1250000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DollarSign&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"$"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;compact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decimals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bedrooms"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;BedDouble&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Bathrooms"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Bath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;decimals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Living area"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2840&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Ruler&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;suffix&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;" sqft"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Year built"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2019&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Calendar&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;noGrouping&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;KeyFacts&lt;/span&gt; &lt;span class="n"&gt;facts&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;facts&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="n"&gt;duration&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;1.4&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Agent cards and brokerage headers often need a rating next to the listing. The &lt;a href="https://dev.to/components/star-rating"&gt;Star rating&lt;/a&gt; component renders fractional stars by clipping the filled layer with &lt;code&gt;clip-path&lt;/code&gt;, so 4.8 shows four full stars and most of a fifth. It exposes one accessible label, "Rated 4.8 out of 5, based on 312 reviews", and hides the individual star icons from assistive tech, so a screen reader hears one sentence instead of five images.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grid and skeleton states
&lt;/h2&gt;

&lt;p&gt;A card is only half the job; the grid around it is the other half. Three rules I follow:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fixed aspect ratio on the photo. The card uses a 3 by 2 frame, and when no &lt;code&gt;src&lt;/code&gt; is passed it renders an illustrated placeholder in one of three variants (&lt;code&gt;modern&lt;/code&gt;, &lt;code&gt;bungalow&lt;/code&gt;, &lt;code&gt;tower&lt;/code&gt;) so a grid never shows a broken image icon.&lt;/li&gt;
&lt;li&gt;Equal height cards through CSS grid, not through padding tricks. Long addresses truncate with an ellipsis instead of wrapping and breaking the row.&lt;/li&gt;
&lt;li&gt;A skeleton while listings load. Render the same number of cards you expect, as muted rectangles with the photo's aspect ratio and three text bars, so the layout does not jump when data arrives.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the skeleton I use, sized to match the card:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;PropertyCardSkeleton&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;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"animate-pulse overflow-hidden rounded-[22px] bg-muted"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"aspect-[3/2] bg-foreground/[0.06]"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"space-y-3 p-4"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"h-5 w-32 rounded bg-foreground/[0.08]"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"h-4 w-48 rounded bg-foreground/[0.06]"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="n"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"h-4 w-40 rounded bg-foreground/[0.06]"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="n"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;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;When the grid needs filtering, sorting, saved homes and load more pagination in one piece, the Property listing grid block in Facade wraps the card with all of that. For a single card, install the free component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add https://facadeui.com/r/property-card.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a &lt;a href="https://dev.to/for/brokerage"&gt;brokerage site&lt;/a&gt;, the card appears first in the listing grid under the hero search and again in the "recently sold" strip near the bottom. Same component, two data sources, one place to fix a bug.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Can the card show a photo carousel?
&lt;/h3&gt;

&lt;p&gt;Not out of the box. The card takes one &lt;code&gt;src&lt;/code&gt;. For a carousel, swap the image element in the installed source for your slider; the badge and heart are positioned absolutely over the photo frame and will sit on top of whatever you put there.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I format prices for other currencies?
&lt;/h3&gt;

&lt;p&gt;The installed source creates its formatter with &lt;code&gt;en-US&lt;/code&gt; and &lt;code&gt;USD&lt;/code&gt;. Change the locale and currency in that one &lt;code&gt;Intl.NumberFormat&lt;/code&gt; call, or lift the formatter into a prop if the site lists in several currencies.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not let the card persist saved homes itself?
&lt;/h3&gt;

&lt;p&gt;Because a component cannot know the right place to store them. Logged in users expect saved homes to follow them across devices, anonymous visitors expect them to survive a refresh, and some sites want neither. The card reports the toggle through &lt;code&gt;onFavoriteChange&lt;/code&gt; and the page decides.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-property-card?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-property-card" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-property-card?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-property-card&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>realestate</category>
      <category>components</category>
      <category>motion</category>
    </item>
    <item>
      <title>Multi step lead form in React with validation</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Wed, 18 Nov 2026 14:00:03 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/multi-step-lead-form-in-react-with-validation-186l</link>
      <guid>https://dev.to/marcoschulz123/multi-step-lead-form-in-react-with-validation-186l</guid>
      <description>&lt;p&gt;Five edge cases a quote form has to survive: the back button, validation on step two, the mobile keyboard covering the submit button, a page refresh and the success state. I learned each of them by shipping a form that failed at one. The &lt;a href="https://dev.to/components/multi-step-lead-form"&gt;Multi-step lead form&lt;/a&gt; in Facade is the version that survives all five, and this article explains how it is built so you can write your own or install it and understand what you are getting.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why split the form at all
&lt;/h2&gt;

&lt;p&gt;A single long form has one advantage: everything is visible. On a desktop that is fine. On a phone, a form with eight fields is a wall, and the field that matters most to the business, the phone number, is at the bottom.&lt;/p&gt;

&lt;p&gt;Splitting the form into three screens changes the psychology. The first screen asks a question the visitor wants to answer: what kind of work do you need? That is not data entry, it is describing their problem. By the time contact details come up, they have invested two steps and the request feels half done. I do not have a study to cite for this; I have the pattern working on client sites and the inbox to show for it.&lt;/p&gt;

&lt;p&gt;Three steps is the number I settled on. Service, Details, Contact. Two is a glorified single form, four starts to feel like a survey.&lt;/p&gt;

&lt;h2&gt;
  
  
  The step state machine
&lt;/h2&gt;

&lt;p&gt;The form holds three pieces of state and derives everything else:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;step&lt;/code&gt;, 0 to 2&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;direction&lt;/code&gt;, 1 or -1, for the slide animation&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data&lt;/code&gt;, a single &lt;code&gt;LeadFormData&lt;/code&gt; object every step writes into
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;timeline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;details&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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;Keeping all fields in one object instead of one state per step means the back button is free. Going back is &lt;code&gt;setStep(step - 1)&lt;/code&gt; and the previous screen renders from the same data it wrote. There is no "save draft of step 1" logic because there is nothing to save.&lt;/p&gt;

&lt;p&gt;A &lt;code&gt;done&lt;/code&gt; flag covers the success state. It is separate from &lt;code&gt;step&lt;/code&gt; because the success screen is not a step; it has no validation and no back button, and the progress bar should read 100 percent.&lt;/p&gt;

&lt;h2&gt;
  
  
  Per step validation
&lt;/h2&gt;

&lt;p&gt;Validation runs when the visitor tries to move forward, not on every keystroke. A function takes the step index and the data and returns an errors object keyed by field name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;Errors&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Partial&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Record&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;keyof&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Errors&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;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Errors&lt;/span&gt; &lt;span class="o"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;service&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Choose the type of work you need."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeline&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;timeline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Pick a timeline."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!/^&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enter a 5 digit ZIP code."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;step&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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;length&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enter your name."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!/^&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;@&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;@&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="o"&gt;^&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;@&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&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;^&lt;/span&gt;\&lt;span class="n"&gt;s&lt;/span&gt;@&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&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="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enter a valid email."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;replace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;\&lt;span class="no"&gt;D&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;g&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&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;length&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;phone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;"Enter a 10 digit phone number."&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;e&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 object has keys, the form stays on the step, shows the messages and does not move. If it is empty, the step advances. When a field with an error changes, its error clears immediately, which is the one place where validation on input is the right call: the visitor is fixing the thing you just flagged, and the red text should go away as soon as they do.&lt;/p&gt;

&lt;p&gt;Error messages render in a &lt;code&gt;role="alert"&lt;/code&gt; region so screen readers announce them, and the step heading receives focus after each transition. That second detail is easy to skip and important: without it, a keyboard user who presses Continue is left with focus on a button that no longer exists.&lt;/p&gt;

&lt;p&gt;The phone validation accepts any format and counts digits. Visitors type &lt;code&gt;(512) 555-0142&lt;/code&gt;, &lt;code&gt;512.555.0142&lt;/code&gt; and &lt;code&gt;5125550142&lt;/code&gt;, and all three are valid. On submit the component strips the phone to digits so your CRM gets one shape.&lt;/p&gt;

&lt;h2&gt;
  
  
  Option cards instead of selects
&lt;/h2&gt;

&lt;p&gt;The first step is the one that sets the tone, and a &lt;code&gt;&amp;lt;select&amp;gt;&lt;/code&gt; labeled "Service" sets the wrong one. The form uses option cards: a two column grid of buttons, each with an icon, a label and a one line description.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;Wrench&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Zap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Home&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;Sparkles&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"lucide-react"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;LeadOption&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/multi-step-lead-form"&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;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;LeadOption&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"repair"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Repair"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Something is broken or leaking"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Wrench&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;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"install"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"New install"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Replace or add equipment"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Zap&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;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"remodel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Remodel"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Kitchen, bath or full room"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Home&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;value&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"maintenance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Maintenance"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Tune-up or inspection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;icon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Sparkles&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;Semantically the grid is a &lt;code&gt;role="radiogroup"&lt;/code&gt; and each card a &lt;code&gt;role="radio"&lt;/code&gt; with &lt;code&gt;aria-checked&lt;/code&gt;. That gives screen readers the same model as native radio buttons while the visual is a tappable card. The selected card shows a check mark that animates in through &lt;code&gt;AnimatePresence&lt;/code&gt;, and the cards shrink slightly on tap unless the visitor prefers reduced motion.&lt;/p&gt;

&lt;p&gt;The timeline on step two uses the same radio pattern as a row of chips: "As soon as possible", "Within 2 weeks", "Within a month", "Just planning". Four chips tell the business how urgent the lead is before anyone picks up the phone.&lt;/p&gt;

&lt;h2&gt;
  
  
  The progress bar
&lt;/h2&gt;

&lt;p&gt;Two indicators sit at the top: a numbered stepper with the step names and a thin bar. The stepper marks the current step with &lt;code&gt;aria-current="step"&lt;/code&gt; and swaps completed numbers for a check icon. The bar is a &lt;code&gt;role="progressbar"&lt;/code&gt; with &lt;code&gt;aria-valuemin&lt;/code&gt;, &lt;code&gt;aria-valuemax&lt;/code&gt; and &lt;code&gt;aria-valuenow&lt;/code&gt;, and its width animates with motion as the visitor advances.&lt;/p&gt;

&lt;p&gt;The width is derived, not stored: &lt;code&gt;(step + 1) / (STEPS.length + 1)&lt;/code&gt;, and &lt;code&gt;1&lt;/code&gt; when done. Counting the success screen as the final segment means the bar never shows 100 percent while there is still a field to fill, which is a small honesty that visitors notice without knowing why.&lt;/p&gt;

&lt;h2&gt;
  
  
  Submit and thank you
&lt;/h2&gt;

&lt;p&gt;The submit handler is &lt;code&gt;async&lt;/code&gt;. It calls &lt;code&gt;onSubmit&lt;/code&gt; with the collected data and waits for the returned promise before showing the success state, so a slow API keeps the button in its loading state instead of flashing a thank you before the lead is saved.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;MultiStepLeadForm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/multi-step-lead-form"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MultiStepLeadForm&lt;/span&gt;
  &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Request a quote"&lt;/span&gt;
  &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;timelines&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"This week"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"This month"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Next 3 months"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Just planning"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;onSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&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;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/leads"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&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="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ok&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Lead not saved"&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="n"&gt;successTitle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Request received"&lt;/span&gt;
  &lt;span class="n"&gt;successMessage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"A licensed electrician will call you within one business hour."&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The success screen greets the visitor by first name, pulled from the name they just typed, and shows the message you pass. It slides in with the same direction aware transition as the steps, so the end of the form feels like the end of the same motion instead of a page change.&lt;/p&gt;

&lt;p&gt;The form is a Pro component. It installs from the private registry once the license key is in &lt;code&gt;components.json&lt;/code&gt;, a one time step covered in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&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;npx shadcn@latest add @facadeui/multi-step-lead-form
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On an &lt;a href="https://dev.to/for/electrician"&gt;electrician site&lt;/a&gt; it replaces the contact form entirely. "What will it cost?" is the question an electrical contractor's visitor asks, and a three step form that starts with "what kind of work" answers it better than a textarea ever did.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Does the form survive a page refresh?
&lt;/h3&gt;

&lt;p&gt;Not by default; state is in React. If a client needs it, persist &lt;code&gt;data&lt;/code&gt; and &lt;code&gt;step&lt;/code&gt; to &lt;code&gt;sessionStorage&lt;/code&gt; in an effect and hydrate them on mount. I leave it out because most visitors finish the three steps in under a minute and a stale restored form is worse than an empty one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I add a fourth step?
&lt;/h3&gt;

&lt;p&gt;Yes, the source is yours after installation. Add the step name to the &lt;code&gt;STEPS&lt;/code&gt; array, a branch in &lt;code&gt;validate&lt;/code&gt;, and a screen in the render switch. The progress and transition logic reads the array length, so nothing else changes.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I send leads to a CRM?
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;onSubmit&lt;/code&gt; receives the full &lt;code&gt;LeadFormData&lt;/code&gt;. Post it to a route handler that forwards to HubSpot, a Google Sheet, a webhook or an email. Returning the fetch promise keeps the loading state until your route responds.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-multi-step-form?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-multi-step-form" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-multi-step-form?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-multi-step-form&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>forms</category>
      <category>a11y</category>
      <category>motion</category>
    </item>
    <item>
      <title>Home valuation lead funnel in React: What's my home worth</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Mon, 16 Nov 2026 14:00:02 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/home-valuation-lead-funnel-in-react-whats-my-home-worth-5779</link>
      <guid>https://dev.to/marcoschulz123/home-valuation-lead-funnel-in-react-whats-my-home-worth-5779</guid>
      <description>&lt;p&gt;Seller leads are the ones real estate agents actually pay for. A buyer lead fills out a form and disappears into a dozen other agents' inboxes. A seller who wants to know what their house is worth is a few months away from signing a listing agreement. That is why the "What's my home worth?" widget exists on almost every agent site, and why most of them are either a third party iframe or a single form that asks for an email before it gives anything back. The &lt;a href="https://dev.to/components/valuation-funnel"&gt;Home valuation funnel&lt;/a&gt; in Facade is my attempt at a version that respects the visitor and still captures the lead. Here is how I built it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the address comes first
&lt;/h2&gt;

&lt;p&gt;Order matters more than design in a lead funnel. The first field sets the tone, and "Email address" as the first field says "we want your data." "Property address" says "tell us about the house." Same form, different first question, very different completion.&lt;/p&gt;

&lt;p&gt;There is a practical reason too. The address is the one piece of information the visitor has that an agent cannot get elsewhere, and it is the field that feels least like a commitment. People type their address into search boxes all day. So the funnel opens with a single address input, &lt;code&gt;autoComplete="street-address"&lt;/code&gt; so phones fill it in one tap, and a short note under it: we use your address to pull nearby comparable sales, and it is never shown publicly.&lt;/p&gt;

&lt;p&gt;Validation on this step is deliberately loose. The component accepts anything six characters or longer. A strict address parser at step one is a wall; the agent will verify the address on the phone anyway.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step by step state
&lt;/h2&gt;

&lt;p&gt;The funnel has five steps: Address, Type, Details, Condition, Contact. Then a loading phase and a result. That is three pieces of state, and I keep them separate:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;step&lt;/code&gt;, a number from 0 to 4&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;phase&lt;/code&gt;, one of &lt;code&gt;"form"&lt;/code&gt;, &lt;code&gt;"loading"&lt;/code&gt; or &lt;code&gt;"result"&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data&lt;/code&gt;, the &lt;code&gt;ValuationData&lt;/code&gt; object that every step writes into
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;ValuationData&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;propertyType&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"single-family"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"condo"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"townhome"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"multi-family"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;beds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;baths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;sqft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"needs-work"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"average"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"updated"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s2"&gt;"renovated"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&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 step has its own validity check, computed from &lt;code&gt;data&lt;/code&gt;, and the Continue button is disabled until the current step is valid. Property type and condition are option cards instead of selects: four large buttons with a label, a one line hint and an icon. A select hides the choices; cards show them, and on a phone they are far easier to tap than a native dropdown.&lt;/p&gt;

&lt;p&gt;Beds, baths and square footage use steppers with minus and plus buttons and a live &lt;code&gt;&amp;lt;output&amp;gt;&lt;/code&gt; element, so the value is announced to screen readers as it changes. Nobody wants to type "3" into a field labeled bedrooms.&lt;/p&gt;

&lt;p&gt;The progress bar above the steps is derived from &lt;code&gt;step&lt;/code&gt; and &lt;code&gt;phase&lt;/code&gt;, not stored. During loading it counts the pending step as done so the bar fills to the end before the result appears, which is a small thing that makes the wait feel intentional.&lt;/p&gt;

&lt;h2&gt;
  
  
  Direction aware transitions
&lt;/h2&gt;

&lt;p&gt;When the visitor clicks Continue, the current step should leave to the left and the next one should enter from the right. When they click Back, the opposite. If you animate every step the same way, Back feels broken.&lt;/p&gt;

&lt;p&gt;The pattern is &lt;code&gt;AnimatePresence&lt;/code&gt; with &lt;code&gt;mode="wait"&lt;/code&gt; and a &lt;code&gt;custom&lt;/code&gt; value that carries the direction. The variants read it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;variants&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;enter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;opacity&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="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;40&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;center&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;opacity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&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="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;exit&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&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="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;opacity&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="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;dir&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;40&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;Set &lt;code&gt;dir&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; before moving forward and &lt;code&gt;-1&lt;/code&gt; before moving back, pass it to both &lt;code&gt;AnimatePresence&lt;/code&gt; and the &lt;code&gt;motion.div&lt;/code&gt; through &lt;code&gt;custom&lt;/code&gt;, and the exit animation of the leaving step uses the fresh direction instead of a stale one. &lt;code&gt;mode="wait"&lt;/code&gt; keeps the two steps from overlapping inside a fixed height container.&lt;/p&gt;

&lt;p&gt;For visitors with &lt;code&gt;prefers-reduced-motion&lt;/code&gt;, the funnel reads &lt;code&gt;useReducedMotion()&lt;/code&gt; and switches to a plain opacity crossfade. The direction logic stays in place; the translate just drops to zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  An estimate range without an AVM API
&lt;/h2&gt;

&lt;p&gt;Here is the part most people get wrong. A real automated valuation model (AVM) needs a data license, and the numbers it returns carry legal weight in some states. For a lead funnel, you do not need a real appraisal. You need a plausible range and a reason to talk to the agent.&lt;/p&gt;

&lt;p&gt;The funnel ships with a demo estimator that works from four inputs you already collected: square footage, property type, condition and room count. It multiplies a base price per square foot for the market by a type factor, a condition factor and a small boost for extra bedrooms and bathrooms, then rounds to the nearest thousand and spreads it into a range of roughly 7 percent either side.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;demoEstimate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ValuationData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ValuationEstimate&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;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;propertyType&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="no"&gt;TYPE_FACTOR&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;propertyType&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&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;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;CONDITIONS&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;condition&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;factor&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="mi"&gt;1&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;roomBoost&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&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="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;beds&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.025&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;max&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="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;baths&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.02&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;mid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sqft&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;roomBoost&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;low&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;0.93&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;mid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;high&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mid&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;1.07&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;1000&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;Set &lt;code&gt;basePricePerSqft&lt;/code&gt; to the client's market and the demo estimator gives sensible numbers. When the client has access to a real AVM or their MLS provides comparables, swap it out with the &lt;code&gt;estimate&lt;/code&gt; prop, which accepts a function returning a &lt;code&gt;ValuationEstimate&lt;/code&gt; or a promise of one. The loading phase waits for it.&lt;/p&gt;

&lt;p&gt;The result screen shows the mid value large, the low to high range under it and a bar with the three markers. The disclaimer under the bar is a prop, and the default is honest: this is an automated estimate, not an appraisal, and your agent will confirm after a walkthrough. Do not remove it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending the lead
&lt;/h2&gt;

&lt;p&gt;The contact step collects name, email and phone, validates the email format and then triggers the estimate. The &lt;code&gt;onLead&lt;/code&gt; callback fires with both the data and the estimate, which means your CRM entry can include the number the seller saw.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ValuationFunnel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ValuationData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ValuationEstimate&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/valuation-funnel"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ValuationFunnel&lt;/span&gt;
  &lt;span class="n"&gt;eyebrow&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Free home estimate"&lt;/span&gt;
  &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"What is your home worth today?"&lt;/span&gt;
  &lt;span class="n"&gt;marketLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Greater Denver"&lt;/span&gt;
  &lt;span class="n"&gt;basePricePerSqft&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;340&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;onLead&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ValuationData&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;estimate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ValuationEstimate&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="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/leads/valuation"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&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;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;estimate&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;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;bookLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Book a walkthrough"&lt;/span&gt;
  &lt;span class="n"&gt;bookHref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/book"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result screen also offers a booking link, &lt;code&gt;bookHref&lt;/code&gt;, which is where the funnel pays off: a seller who just saw a number they liked is the easiest appointment an agent will book all week.&lt;/p&gt;

&lt;p&gt;The funnel is a Pro block. It installs from the private registry after the one time license setup in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&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;npx shadcn@latest add @facadeui/valuation-funnel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On an &lt;a href="https://dev.to/for/real-estate-agent"&gt;agent site&lt;/a&gt; it goes below the listings and the testimonials, as the second to last block before the FAQ. By then the visitor has seen that the agent sells homes like theirs, and the question "what is mine worth" is already in their head.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Is showing an estimate before collecting contact details a mistake?
&lt;/h3&gt;

&lt;p&gt;The funnel asks for contact details before the estimate, on the last step. By then the visitor has invested four steps and the estimate is one click away, which is a much better moment to ask than step one.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I skip the demo estimator and only collect the lead?
&lt;/h3&gt;

&lt;p&gt;Yes. Pass an &lt;code&gt;estimate&lt;/code&gt; function that returns a wide range or a fixed placeholder and rewrite the result copy through the props, or resolve the estimate server side and email it. The step logic does not care where the numbers come from.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it store anything in the browser?
&lt;/h3&gt;

&lt;p&gt;No. State lives in React for the current visit. If you want the funnel to survive a refresh, persist &lt;code&gt;data&lt;/code&gt; to &lt;code&gt;sessionStorage&lt;/code&gt; in the consuming component; the source is yours after installation.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/home-valuation-form-react?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-home-valuation-form-react" rel="noopener noreferrer"&gt;https://facadeui.com/blog/home-valuation-form-react?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-home-valuation-form-react&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>realestate</category>
      <category>leadgeneration</category>
      <category>motion</category>
    </item>
    <item>
      <title>Service area map with ZIP code checker in React</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Sat, 14 Nov 2026 14:00:02 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/service-area-map-with-zip-code-checker-in-react-4g69</link>
      <guid>https://dev.to/marcoschulz123/service-area-map-with-zip-code-checker-in-react-4g69</guid>
      <description>&lt;p&gt;The client request I hear most often on home services sites is some version of "can the map show all the areas we serve?" The first few times I answered it with an embedded Google Map and a list of suburbs. It looked like every other contractor site and it did not answer the visitor's real question, which is not "where are you" but "will you come to me." The &lt;a href="https://dev.to/components/service-area"&gt;Service area&lt;/a&gt; block in Facade is the version I settled on after building this section for HVAC companies, plumbers and cleaning services. Here is how it is put together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zones as data, not as pixels
&lt;/h2&gt;

&lt;p&gt;The first decision is to treat service zones as data. Each zone is an object with an id, a display name, a shape, a label anchor, the cities inside it and the ZIP codes it covers. The map, the zone list and the ZIP checker all read from the same array, so adding a zone means adding one object, not editing three places.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ServiceZone&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/service-area"&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;zones&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ServiceZone&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"north"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"North Austin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"M150 40 L238 30 L262 70 L232 108 L170 120 L136 84 Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;198&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;76&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;cities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Allandale"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Crestview"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Domain"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"North Burnet"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;zips&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"78757"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78758"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78759"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78727"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Same day"&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="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"central"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Central Austin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"M156 172 L190 214 L248 200 L270 252 L214 296 L140 284 L118 228 Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;190&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;cities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Zilker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Travis Heights"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Bouldin Creek"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Circle C"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;zips&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"78704"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78745"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78748"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78749"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Same day"&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;The &lt;code&gt;eta&lt;/code&gt; field is optional and it is the field that does the selling. "Same day" next to a zone name tells a visitor with a broken furnace more than any paragraph. For zones further out, "Next day" is honest and still useful.&lt;/p&gt;

&lt;h2&gt;
  
  
  A stylized SVG map instead of Google Maps
&lt;/h2&gt;

&lt;p&gt;The shapes are SVG paths in a fixed 400 by 320 viewBox. That sounds like a step backward from a real map, so let me explain why I prefer it on a marketing page.&lt;/p&gt;

&lt;p&gt;A Google Maps embed loads a third party script, a tile set and its own fonts. On a mobile connection that is a noticeable hit to Largest Contentful Paint, and Google's own Core Web Vitals guidance treats 2.5 seconds as the threshold for a good LCP. An inline SVG with six polygons costs nothing. It also inherits your theme: the zones use &lt;code&gt;currentColor&lt;/code&gt; and the brand token, so the map looks like your site in light and dark mode instead of a gray rectangle with a red pin.&lt;/p&gt;

&lt;p&gt;The other reason is honesty. Real service areas are not perfect circles around a shop. They follow highways, rivers and county lines, and a hand drawn polygon communicates "we know this town" better than a radius overlay. The decorative river line in the Facade block has a legend label you can rename or hide with &lt;code&gt;riverLabel=""&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Drawing the paths is a one time task. I open the real service area in a map tool, sketch the polygons on a 400 by 320 grid and copy the coordinates. Half an hour per client, and the result is a map that never changes under you when a map provider updates its styles.&lt;/p&gt;

&lt;h3&gt;
  
  
  Keyboard and screen reader behavior
&lt;/h3&gt;

&lt;p&gt;Each zone is focusable. Arrow keys move between zones, Enter or Space selects one, and the zone list on the side expands to show its cities and ZIP codes. The SVG itself is a &lt;code&gt;role="group"&lt;/code&gt; with a label, so a screen reader user hears "Service area map" and can tab into the list instead of being handed a pile of path elements.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ZIP code checker
&lt;/h2&gt;

&lt;p&gt;The checker is a small form under the map. The input accepts digits only and stops at five; the &lt;code&gt;onChange&lt;/code&gt; handler strips everything else, so pasting "78704-1234" leaves "78704". On submit, the component validates against &lt;code&gt;^\d{5}$&lt;/code&gt; and then runs a lookup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;zips&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;includes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That is the whole algorithm. No geocoding, no API key, no rate limits. The trade off is that you have to maintain the ZIP list, which for a local business is a list of twenty to sixty codes they already know by heart.&lt;/p&gt;

&lt;p&gt;The result messages are functions, so you can write them in the client's voice:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ServiceArea&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/service-area"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ServiceArea&lt;/span&gt;
  &lt;span class="n"&gt;eyebrow&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Service area"&lt;/span&gt;
  &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Heating and cooling across greater Austin"&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Two hour arrival windows in every zone. Enter your ZIP to confirm."&lt;/span&gt;
  &lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;hqLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Dispatch on Burnet Rd"&lt;/span&gt;
  &lt;span class="n"&gt;hqX&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;200&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;hqY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;160&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;checkerLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Do we serve your address?"&lt;/span&gt;
  &lt;span class="n"&gt;checkerPlaceholder&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"5 digit ZIP"&lt;/span&gt;
  &lt;span class="n"&gt;successMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`Yes. ${zone.name} gets ${zone.eta?.toLowerCase() ?? "fast"} service.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;failureMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`${zip} is outside our area for now.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;ctaLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Schedule a visit"&lt;/span&gt;
  &lt;span class="n"&gt;ctaHref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/book"&lt;/span&gt;
  &lt;span class="n"&gt;waitlistLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Tell us when you expand"&lt;/span&gt;
  &lt;span class="n"&gt;waitlistHref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/waitlist"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A successful check also selects the matching zone on the map, so the visitor sees their neighborhood light up at the same moment they read the answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The animated result state
&lt;/h2&gt;

&lt;p&gt;Three states need motion here, and each one is small.&lt;/p&gt;

&lt;p&gt;An invalid entry, say four digits, shakes the input. The block increments a counter on each failed submit and keys the shake animation off it, which means the shake replays on every attempt instead of only the first.&lt;/p&gt;

&lt;p&gt;A match renders a success card with the zone name, the ETA and a CTA button. A miss renders a card with the failure message and a waitlist link, because a "no" with a next step keeps the lead instead of losing it. Both cards animate in through &lt;code&gt;AnimatePresence&lt;/code&gt; with &lt;code&gt;mode="wait"&lt;/code&gt;, so switching from a yes to a no does not stack two cards for a frame.&lt;/p&gt;

&lt;p&gt;All of it respects &lt;code&gt;prefers-reduced-motion&lt;/code&gt;. The block reads &lt;code&gt;useReducedMotion()&lt;/code&gt; and skips the shake and the entrance transforms for visitors who asked for less movement.&lt;/p&gt;

&lt;h2&gt;
  
  
  Linking zones to city pages
&lt;/h2&gt;

&lt;p&gt;The service area is also an internal linking tool. Most home services sites have a page per city or suburb for local search. Add an &lt;code&gt;href&lt;/code&gt; to your own data shape, or use the zone id to build the link, and render the city list as links in the panel next to the map. A visitor who finds their zone can jump straight to "AC repair in Round Rock," which is the page you want ranking for that query.&lt;/p&gt;

&lt;p&gt;I keep the zone array in a single &lt;code&gt;lib/service-area.ts&lt;/code&gt; file and import it into the map block, the footer's service list and the city pages' &lt;code&gt;generateStaticParams&lt;/code&gt;. One file, three consumers, no drift.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing it
&lt;/h2&gt;

&lt;p&gt;The Service area is a Pro block. It installs from the private registry once your license key is in &lt;code&gt;components.json&lt;/code&gt;, which is a one time step covered in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&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;npx shadcn@latest add @facadeui/service-area
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file lands in &lt;code&gt;components/facade/service-area.tsx&lt;/code&gt; and the only dependencies are &lt;code&gt;motion&lt;/code&gt; and &lt;code&gt;lucide-react&lt;/code&gt;. On an &lt;a href="https://dev.to/for/hvac"&gt;HVAC site&lt;/a&gt; I put it fourth, right after the process steps and before the reviews, because by then the visitor knows what the company does and wants to know whether it applies to them.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Can I use real geographic shapes instead of hand drawn polygons?
&lt;/h3&gt;

&lt;p&gt;Yes. Export county or ZIP boundaries from a GIS source as SVG paths, scale them into the 400 by 320 viewBox and paste the path strings into the zone objects. The component does not care where the path came from.&lt;/p&gt;

&lt;h3&gt;
  
  
  What about addresses, not ZIP codes?
&lt;/h3&gt;

&lt;p&gt;ZIP codes are deliberate. An address lookup needs a geocoding API, which adds a key, a cost and a privacy notice. Five digits are enough to answer "do you come to me" and most people know their ZIP without looking it up.&lt;/p&gt;

&lt;h3&gt;
  
  
  How many zones work before the map gets crowded?
&lt;/h3&gt;

&lt;p&gt;Four to eight. Beyond that, labels start overlapping in the fixed viewBox. If a client covers a whole metro region, group suburbs into larger zones and list the individual cities in the panel instead of drawing each one.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/service-area-map-react?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-service-area-map-react" rel="noopener noreferrer"&gt;https://facadeui.com/blog/service-area-map-react?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-service-area-map-react&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>localbusiness</category>
      <category>svg</category>
      <category>motion</category>
    </item>
    <item>
      <title>Plumber website template for Next.js: the 10 blocks that get calls</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Thu, 12 Nov 2026 14:00:05 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/plumber-website-template-for-nextjs-the-10-blocks-that-get-calls-321c</link>
      <guid>https://dev.to/marcoschulz123/plumber-website-template-for-nextjs-the-10-blocks-that-get-calls-321c</guid>
      <description>&lt;p&gt;A plumber's website has one job: turn a person with water on the floor into a phone call. Everything on the page either helps that or gets in the way. I have built enough sites for trades businesses to know that the layout is not where the time goes. The time goes into the five or six sections that answer the visitor's questions before they bounce back to the search results. This is the page plan I use now, built from Facade blocks, and the reasoning behind each one.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a plumber visitor actually wants
&lt;/h2&gt;

&lt;p&gt;Think about who lands on the page. Some have an emergency: a burst pipe, a water heater that quit on a Sunday. Others are planning a remodel or a repipe. Both groups ask the same four questions, in roughly this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Is someone available right now, or at least today?&lt;/li&gt;
&lt;li&gt;Do you come to where I live?&lt;/li&gt;
&lt;li&gt;Can I trust you in my house?&lt;/li&gt;
&lt;li&gt;What will it cost, roughly?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A template that answers those four questions above the fold and in the first two scrolls will beat a prettier one that does not. The ten blocks below map to the questions, and the order is the order of the questions.&lt;/p&gt;

&lt;h2&gt;
  
  
  The block order
&lt;/h2&gt;

&lt;p&gt;This is the sequence I ship for a plumbing company, top to bottom. The same list is the default on the &lt;a href="https://dev.to/for/plumber"&gt;plumber industry page&lt;/a&gt;, where you can see the stacked preview.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hero, local business&lt;/li&gt;
&lt;li&gt;Stats band&lt;/li&gt;
&lt;li&gt;Process steps&lt;/li&gt;
&lt;li&gt;Service area&lt;/li&gt;
&lt;li&gt;Testimonials wall&lt;/li&gt;
&lt;li&gt;FAQ section&lt;/li&gt;
&lt;li&gt;Multi step lead form&lt;/li&gt;
&lt;li&gt;CTA section&lt;/li&gt;
&lt;li&gt;Footer, big&lt;/li&gt;
&lt;li&gt;Sticky contact bar (mobile only, floats over everything)&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  1. Hero with a live answer to "are you available"
&lt;/h3&gt;

&lt;p&gt;The &lt;a href="https://dev.to/components/hero-local-business"&gt;Hero, local business&lt;/a&gt; block is built for exactly this page. It shows the star rating and review count up top, a headline with a rotating service word, a primary button, a phone link and three trust items. The floating cards on the right show an appointment card, a review and a technician card with an ETA, which is the visual version of "yes, someone is coming."&lt;/p&gt;

&lt;p&gt;The rotating words matter more than they look. A plumber does drain cleaning, water heaters, leak repair and remodels, and a static headline can only name one. The &lt;code&gt;rotatingWords&lt;/code&gt; prop cycles through them.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;HeroLocalBusiness&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/hero-local-business"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;HeroLocalBusiness&lt;/span&gt;
  &lt;span class="n"&gt;rating&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;reviewCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"612"&lt;/span&gt;
  &lt;span class="n"&gt;eyebrowSuffix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Google reviews in Austin"&lt;/span&gt;
  &lt;span class="n"&gt;headlinePrefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Same day"&lt;/span&gt;
  &lt;span class="n"&gt;rotatingWords&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"drain cleaning"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"water heater repair"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"leak detection"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"repiping"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;headlineSuffix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"by licensed plumbers"&lt;/span&gt;
  &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Upfront pricing, two hour arrival windows and a 2 year warranty on every repair."&lt;/span&gt;
  &lt;span class="n"&gt;primaryCta&lt;/span&gt;&lt;span class="o"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Book a visit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"#quote"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="o"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"(512) 555-0142"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tel:+15125550142"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;trustItems&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Licensed and insured"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"No overtime charges"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Family owned since 2004"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;technician&lt;/span&gt;&lt;span class="o"&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;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Mike R."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Arriving in 25 min"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;vehicle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Van 7"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;interval&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;2600&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. Stats band: trust in numbers
&lt;/h3&gt;

&lt;p&gt;Years in business, jobs completed, average rating, response time. Four numbers that count up when they scroll into view. Only use figures the client can defend.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Process steps: what happens after I call
&lt;/h3&gt;

&lt;p&gt;Call, diagnose, fixed price quote, repair. The connecting line draws as the visitor scrolls, and each step lights up as it passes. For an emergency visitor this is the section that lowers the heart rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  Service area with a ZIP checker
&lt;/h2&gt;

&lt;p&gt;"Do you come to my town" is the second question, and a paragraph listing suburbs does not answer it. The &lt;a href="https://dev.to/components/service-area"&gt;Service area&lt;/a&gt; block does two things: it shows a stylized SVG map with numbered zones, and it offers a ZIP code checker. The visitor types five digits, hits Enter, and gets a yes with the zone's ETA or a polite no with a waitlist link.&lt;/p&gt;

&lt;p&gt;Zones are plain data. Each one has a name, an SVG path in a 400 by 320 viewBox, a label position, a list of cities and a list of ZIP codes. The checker does a &lt;code&gt;zones.find(z =&amp;gt; z.zips.includes(zip))&lt;/code&gt; lookup, nothing more, which means it works without any API and the data lives next to your city pages.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ServiceArea&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;ServiceZone&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/service-area"&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;zones&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ServiceZone&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&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;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"central"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Central Austin"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"M156 172 L190 214 L248 200 L270 252 L214 296 L140 284 L118 228 Z"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelX&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;190&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;labelY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;cities&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Zilker"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Travis Heights"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Bouldin Creek"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;zips&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"78704"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78745"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"78748"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;eta&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Same day"&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;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ServiceArea&lt;/span&gt;
  &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Serving all of Austin and Round Rock"&lt;/span&gt;
  &lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;zones&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;hqLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Shop on Burnet Rd"&lt;/span&gt;
  &lt;span class="n"&gt;checkerLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Do we come to you?"&lt;/span&gt;
  &lt;span class="n"&gt;successMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`Yes. ${zone.name} gets ${zone.eta?.toLowerCase()} service.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;failureMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`${zip} is just outside our area right now.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;ctaLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Book a visit"&lt;/span&gt;
  &lt;span class="n"&gt;ctaHref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"#quote"&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Service area is a Pro block, so it installs from the private registry after the one time license setup described in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&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;npx shadcn@latest add @facadeui/service-area
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Reviews, FAQ and the quote form
&lt;/h2&gt;

&lt;p&gt;The testimonials wall and the FAQ section answer question three. Real reviews with first names and neighborhoods, and an FAQ that covers "do you charge for estimates", "are you licensed", "do you offer financing". The FAQ block can also emit FAQPage JSON-LD from the same array that renders the accordion, which is how those answers end up in search results.&lt;/p&gt;

&lt;p&gt;Question four, cost, is where most plumber sites lose the lead. A blank textarea labeled "Describe your issue" is work for the visitor. The &lt;a href="https://dev.to/components/multi-step-lead-form"&gt;Multi-step lead form&lt;/a&gt; replaces it with three steps: pick the service from option cards, pick a timeline and enter your ZIP, then name, email and phone. Each step validates before it moves on, the progress bar is a real &lt;code&gt;role="progressbar"&lt;/code&gt;, and the form slides in the direction of travel.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;MultiStepLeadForm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/multi-step-lead-form"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MultiStepLeadForm&lt;/span&gt;
  &lt;span class="n"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Get a fixed price quote"&lt;/span&gt;
  &lt;span class="n"&gt;timelines&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Today"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"This week"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Within a month"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Just planning"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;onSubmit&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;LeadFormData&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="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"/api/leads"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"POST"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&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;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;successTitle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Got it"&lt;/span&gt;
  &lt;span class="n"&gt;successMessage&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"A dispatcher will call you back within the hour during business hours."&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;LeadFormData&lt;/code&gt; gives you &lt;code&gt;service&lt;/code&gt;, &lt;code&gt;timeline&lt;/code&gt;, &lt;code&gt;zip&lt;/code&gt;, &lt;code&gt;details&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, &lt;code&gt;email&lt;/code&gt; and &lt;code&gt;phone&lt;/code&gt;, with the phone stripped to digits. Post it to your CRM, a webhook, or an email route.&lt;/p&gt;

&lt;h2&gt;
  
  
  The mobile call bar
&lt;/h2&gt;

&lt;p&gt;On a phone, visitors scroll past the hero and lose the phone number. The &lt;a href="https://dev.to/components/sticky-contact-bar"&gt;Sticky contact bar&lt;/a&gt; fixes that with four actions pinned to the bottom edge: Call, Text, Directions, Book. It appears after a short scroll, tucks away when the visitor keeps scrolling down and comes back the moment they scroll up. The &lt;code&gt;mobileOnly&lt;/code&gt; prop adds &lt;code&gt;md:hidden&lt;/code&gt;, so desktop visitors never see it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;StickyContactBar&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/sticky-contact-bar"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;StickyContactBar&lt;/span&gt;
  &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"(512) 555-0142"&lt;/span&gt;
  &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"5600 Burnet Rd, Austin, TX 78756"&lt;/span&gt;
  &lt;span class="n"&gt;bookingUrl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"#quote"&lt;/span&gt;
  &lt;span class="n"&gt;threshold&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;240&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;mobileOnly&lt;/span&gt;
&lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It is a free, MIT licensed component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add https://facadeui.com/r/sticky-contact-bar.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Measuring calls
&lt;/h2&gt;

&lt;p&gt;A plumber does not care about sessions. They care about calls. Two things I wire up on every site:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every &lt;code&gt;tel:&lt;/code&gt; link fires an analytics event. The sticky bar, the hero phone link and the footer phone count as separate sources, so the client sees which one earns its place.&lt;/li&gt;
&lt;li&gt;The lead form's &lt;code&gt;onSubmit&lt;/code&gt; fires a second event with the chosen service, which tells you which services the website brings in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I keep one phone number everywhere and track clicks instead of swapping in tracking numbers, which can hurt the Google Business Profile match. Ship these ten blocks, swap the copy and the colors, and the layout work is done.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Can I use these blocks with a CMS?
&lt;/h3&gt;

&lt;p&gt;Yes. Every block takes plain props, so the content can come from Sanity, Contentful, a Markdown file or a database. Map your CMS fields to the props in a server component and pass them down.&lt;/p&gt;

&lt;h3&gt;
  
  
  Do I need all ten blocks?
&lt;/h3&gt;

&lt;p&gt;No. A two person shop can drop the stats band and the testimonials wall and still have a page that converts. Keep the hero, the service area, the lead form and the sticky bar; those four answer the four questions.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the ZIP checker work for Canadian postal codes?
&lt;/h3&gt;

&lt;p&gt;Not out of the box. The checker validates five digits before it looks up the zone. The source is yours after installation, so the regex and the &lt;code&gt;zips&lt;/code&gt; matching are a one line change.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/plumber-website-template-nextjs?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-plumber-website-template-nextjs" rel="noopener noreferrer"&gt;https://facadeui.com/blog/plumber-website-template-nextjs?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-plumber-website-template-nextjs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>localbusiness</category>
      <category>template</category>
      <category>shadcn</category>
    </item>
    <item>
      <title>Let Claude Code install UI components with an MCP server</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Tue, 10 Nov 2026 14:00:03 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/let-claude-code-install-ui-components-with-an-mcp-server-4hm3</link>
      <guid>https://dev.to/marcoschulz123/let-claude-code-install-ui-components-with-an-mcp-server-4hm3</guid>
      <description>&lt;p&gt;When I ask Claude Code to "add a hero with a phone number and rotating service words" in a project without any component context, it writes one from scratch. The result is usually fine and always different from the last one. The animations are invented on the spot, the accessibility is whatever the model remembered that day, and the next page gets a slightly different hero. An MCP server fixes this by giving the agent a catalog to pull from instead of a blank file. This is how the Facade MCP server works with Claude Code, what the agent gets back, and where it still needs a human.&lt;/p&gt;

&lt;h2&gt;
  
  
  What MCP is, in one paragraph
&lt;/h2&gt;

&lt;p&gt;The Model Context Protocol is a small JSON-RPC protocol that lets an AI agent call tools that live outside the model. A server publishes a list of tools with names, descriptions and input schemas. The agent reads the list, decides when a tool fits the task, calls it with arguments and gets text back. Claude Code, Cursor and Codex all speak it. The Facade server runs as a plain HTTP endpoint on the same Next.js app that serves the docs, so there is nothing to install locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Adding Facade to Claude Code
&lt;/h2&gt;

&lt;p&gt;One command registers the server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http facade https://facadeui.com/api/mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That gives the agent the 33 free items. With a Pro license, pass the key as a header so the agent can also read Pro sources:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;claude mcp add --transport http facade https://facadeui.com/api/mcp \
  --header &lt;span class="s2"&gt;"Authorization: Bearer $FACADE_LICENSE_KEY"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The server exposes four tools:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;list_components&lt;/code&gt; searches the catalog by free text, kind (component or block), category or tier.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_component&lt;/code&gt; returns the docs for one item: description, props table, install command, usage example and, where allowed, the full TypeScript source.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;get_install_command&lt;/code&gt; returns a single &lt;code&gt;npx shadcn@latest add&lt;/code&gt; line for several items.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;suggest_page&lt;/code&gt; returns an ordered block list for a business type.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Nothing in the server writes to your project. The agent reads from it and then runs the shadcn CLI in your repo like any other shell command, so the files that land in &lt;code&gt;components/facade/&lt;/code&gt; are the same ones a developer would install by hand.&lt;/p&gt;

&lt;h2&gt;
  
  
  Asking the agent to build a plumber page
&lt;/h2&gt;

&lt;p&gt;Here is a prompt I use as a test, in a fresh Next.js project with shadcn initialized:&lt;/p&gt;

&lt;p&gt;"Build the home page for a plumber in Austin using Facade blocks. Live rating in the hero, a service area map with a ZIP checker, and a mobile call bar. Phone is 512 555 0147."&lt;/p&gt;

&lt;p&gt;What happens, step by step:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The agent calls &lt;code&gt;suggest_page&lt;/code&gt; with &lt;code&gt;"plumber"&lt;/code&gt; and gets a numbered block order back: hero, logo cloud, features, process steps, service area, testimonials, pricing, FAQ, contact, footer, each with its first line of usage.&lt;/li&gt;
&lt;li&gt;It calls &lt;code&gt;get_component&lt;/code&gt; for the blocks it decided to use, reads the props, and notices that &lt;code&gt;hero-local-business&lt;/code&gt; and &lt;code&gt;sticky-contact-bar&lt;/code&gt; are free while &lt;code&gt;service-area&lt;/code&gt; is Pro.&lt;/li&gt;
&lt;li&gt;It calls &lt;code&gt;get_install_command&lt;/code&gt; with the three names and runs the returned command.&lt;/li&gt;
&lt;li&gt;It writes &lt;code&gt;app/page.tsx&lt;/code&gt;, passing real values from my prompt into real props.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The page it produced on my last run, lightly trimmed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;HeroLocalBusiness&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/hero-local-business"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;ServiceArea&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/service-area"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;StickyContactBar&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"@/components/facade/sticky-contact-bar"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nc"&gt;Home&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;return&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;HeroLocalBusiness&lt;/span&gt;
        &lt;span class="n"&gt;rating&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;4.9&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;reviewCount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"640+"&lt;/span&gt;
        &lt;span class="n"&gt;headlinePrefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Austin plumbers for"&lt;/span&gt;
        &lt;span class="n"&gt;rotatingWords&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"burst pipes"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"water heaters"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"slab leaks"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"remodels"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;description&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Licensed, insured and on the way in under an hour across Travis County."&lt;/span&gt;
        &lt;span class="n"&gt;primaryCta&lt;/span&gt;&lt;span class="o"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Book a visit"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"/book"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="o"&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;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"(512) 555-0147"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;href&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"tel:+15125550147"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;trustItems&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Licensed and insured"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Same day service"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"Upfront pricing"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ServiceArea&lt;/span&gt;
        &lt;span class="n"&gt;heading&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Where we work"&lt;/span&gt;
        &lt;span class="n"&gt;checkerLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Check your ZIP code"&lt;/span&gt;
        &lt;span class="n"&gt;successMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;zone&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`Yes, we serve ${zip}. ${zone.name} is a ${zone.eta ?? "same day"} call.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;failureMessage&lt;/span&gt;&lt;span class="o"&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;zip&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="sb"&gt;`We do not cover ${zip} yet. Join the waitlist and we will let you know.`&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="n"&gt;ctaLabel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Request a visit"&lt;/span&gt;
        &lt;span class="n"&gt;ctaHref&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/book"&lt;/span&gt;
      &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;StickyContactBar&lt;/span&gt; &lt;span class="n"&gt;phone&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"512 555 0147"&lt;/span&gt; &lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2200 S Lamar Blvd, Austin, TX"&lt;/span&gt; &lt;span class="n"&gt;bookingUrl&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"/book"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;/&amp;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;Every prop in that file exists. &lt;code&gt;rotatingWords&lt;/code&gt; is a real prop on the &lt;a href="https://dev.to/components/hero-local-business"&gt;Hero, local business&lt;/a&gt; block, &lt;code&gt;successMessage&lt;/code&gt; on the &lt;a href="https://dev.to/components/service-area"&gt;Service area&lt;/a&gt; block really receives the matched zone, and the &lt;a href="https://dev.to/components/sticky-contact-bar"&gt;Sticky contact bar&lt;/a&gt; really builds &lt;code&gt;tel:&lt;/code&gt; and &lt;code&gt;sms:&lt;/code&gt; links from the phone string and a Google Maps directions link from the address. The agent did not guess any of them, because &lt;code&gt;get_component&lt;/code&gt; had shown it the props table a minute earlier.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the agent gets back
&lt;/h2&gt;

&lt;p&gt;The tool responses are plain text, formatted for a model rather than for a browser. &lt;code&gt;list_components&lt;/code&gt; returns one line per item with the slug, kind, category, tier and description. &lt;code&gt;get_component&lt;/code&gt; returns the same Markdown page a human can open by adding &lt;code&gt;.md&lt;/code&gt; to any component URL. For free items that includes the full source, which matters: the agent can read how the hero rotates words or how the bar hides on scroll and adapt the page around it instead of treating the component as a black box.&lt;/p&gt;

&lt;p&gt;For Pro items without a license header the source is withheld and the response says so, with a link to the setup docs. The agent still gets the props and the install command, so it can write correct usage; it just cannot read or modify the internals until the key is in place.&lt;/p&gt;

&lt;h2&gt;
  
  
  Limits, and prompts that work
&lt;/h2&gt;

&lt;p&gt;The server is a catalog, not a designer. &lt;code&gt;suggest_page&lt;/code&gt; knows three page shapes: real estate, agency and local business. It will not invent a block that does not exist, which is the point, but it also means that if your project needs a restaurant menu with reservations, the agent should combine the service menu and the booking picker rather than wait for a "restaurant" suggestion.&lt;/p&gt;

&lt;p&gt;Three habits make the results better:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Name the business and the city. "A dentist in Portland" gives the agent the data for the hero copy and the service area; "a landing page" does not.&lt;/li&gt;
&lt;li&gt;Give real facts. Phone number, address, hours and rating in the prompt turn into props instead of placeholders the client has to find later.&lt;/li&gt;
&lt;li&gt;Ask for the install, then review the page before asking for the next section. Agents are good at wiring props and less good at knowing which block the client will actually want third.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Prompts that have worked for me: "Build a landing page for a dental clinic in Miami using Facade blocks." "Replace our contact form with the Facade multi step lead form and keep our fields." "Add the Facade availability table for units A to D, data from units.json."&lt;/p&gt;

&lt;p&gt;The block order the agent follows for home services is the same one documented on the &lt;a href="https://dev.to/for/plumber"&gt;plumber page&lt;/a&gt;. If you want to skip the agent entirely, that page has the one line install for the whole set.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Does this work in Cursor or Codex too?
&lt;/h3&gt;

&lt;p&gt;Yes. Any client that supports HTTP MCP servers can connect. In Cursor, add &lt;code&gt;{ "mcpServers": { "facade": { "url": "https://facadeui.com/api/mcp" } } }&lt;/code&gt; to &lt;code&gt;.cursor/mcp.json&lt;/code&gt;. The tools and responses are identical.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does the MCP server change files in my project?
&lt;/h3&gt;

&lt;p&gt;No. It only answers questions. The shadcn CLI, run by the agent in your repository, writes the files. You can inspect every command before it runs, as with any other shell command Claude Code proposes.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I run the server locally or self host it?
&lt;/h3&gt;

&lt;p&gt;The server is part of the Facade site, and the free catalog is also published as &lt;code&gt;llms.txt&lt;/code&gt; and per component Markdown pages, which agents can read without MCP at all. If you need an offline copy, &lt;code&gt;llms-full.txt&lt;/code&gt; contains the full source of every free item in one file.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/mcp-server-ui-components?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-mcp-server-ui-components" rel="noopener noreferrer"&gt;https://facadeui.com/blog/mcp-server-ui-components?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-mcp-server-ui-components&lt;/a&gt;&lt;/p&gt;

</description>
      <category>mcp</category>
      <category>claudecode</category>
      <category>aiagents</category>
      <category>shadcn</category>
    </item>
    <item>
      <title>shadcn registry explained: how to ship your own components</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Sun, 08 Nov 2026 14:00:03 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/shadcn-registry-explained-how-to-ship-your-own-components-3j3d</link>
      <guid>https://dev.to/marcoschulz123/shadcn-registry-explained-how-to-ship-your-own-components-3j3d</guid>
      <description>&lt;p&gt;The thing that makes shadcn different from a component library is that the code lands in your project. You run one command, a file appears in &lt;code&gt;components/ui&lt;/code&gt;, and from that moment it is yours. Fewer people know that the same mechanism is open to anyone. A shadcn registry is just JSON on a URL, and the CLI will happily install from yours. Facade is built on that mechanism, and this article explains how it works so you can ship your own components the same way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What registry.json is
&lt;/h2&gt;

&lt;p&gt;A registry is a static index plus one JSON file per item. The index, &lt;code&gt;registry.json&lt;/code&gt;, lists the items with their names, types and descriptions. It is what a human or a tool reads to find out what exists. Facade's lives at &lt;code&gt;/r/registry.json&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"$schema"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://ui.shadcn.com/schema/registry.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"facade"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"homepage"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://facadeui.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"items"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"open-now-badge"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"registry:ui"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Open now badge"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Live open or closed pill computed from weekly hours in the business's own time zone."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"motion"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"registryDependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"utils"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"categories"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"local-business"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"meta"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"tier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"free"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"files"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"path"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"registry/items/open-now-badge/open-now-badge.tsx"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"registry:ui"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
          &lt;/span&gt;&lt;span class="nl"&gt;"target"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"components/facade/open-now-badge.tsx"&lt;/span&gt;&lt;span class="w"&gt;
        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The index is optional for installs. The CLI does not need it; it fetches the item file directly. But it is what lets a gallery page, an AI agent or another developer discover what the registry holds, so publish it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The item schema
&lt;/h2&gt;

&lt;p&gt;Each installable item is a &lt;code&gt;registry-item.json&lt;/code&gt; document at its own URL. For Facade that is &lt;code&gt;/r/&amp;lt;name&amp;gt;.json&lt;/code&gt;. The important fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;name&lt;/code&gt;: the slug, used in install commands and as the file name.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;type&lt;/code&gt;: &lt;code&gt;registry:ui&lt;/code&gt; for a single component, &lt;code&gt;registry:block&lt;/code&gt; for a page section, plus &lt;code&gt;registry:hook&lt;/code&gt;, &lt;code&gt;registry:lib&lt;/code&gt;, &lt;code&gt;registry:style&lt;/code&gt; and a few others. The type decides where the CLI puts the file by default.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;dependencies&lt;/code&gt;: npm packages to install. Facade items list &lt;code&gt;motion&lt;/code&gt; and &lt;code&gt;lucide-react&lt;/code&gt;, nothing else.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;registryDependencies&lt;/code&gt;: other registry items this one needs. &lt;code&gt;"utils"&lt;/code&gt; resolves to the shadcn &lt;code&gt;cn&lt;/code&gt; helper, so your component can import &lt;code&gt;@/lib/utils&lt;/code&gt; and the CLI makes sure it exists.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;files&lt;/code&gt;: an array of &lt;code&gt;{ path, type, target, content }&lt;/code&gt;. &lt;code&gt;content&lt;/code&gt; is the full source as a string. &lt;code&gt;target&lt;/code&gt; is where it lands in the consumer's project; Facade targets &lt;code&gt;components/facade/&amp;lt;name&amp;gt;.tsx&lt;/code&gt; so the files never collide with the consumer's own &lt;code&gt;components/ui&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cssVars&lt;/code&gt; and &lt;code&gt;css&lt;/code&gt;: optional theme variables and CSS the item needs. Facade uses semantic tokens that shadcn already defines, plus a &lt;code&gt;--brand&lt;/code&gt; pair documented once in the install docs, so the items ship without &lt;code&gt;cssVars&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Two rules I learned the hard way. First, the &lt;code&gt;content&lt;/code&gt; string is the source of truth; the &lt;code&gt;path&lt;/code&gt; is informational. Keep the two in sync with a build script, never by hand. Second, the component must import only from packages in &lt;code&gt;dependencies&lt;/code&gt;, from &lt;code&gt;@/lib/utils&lt;/code&gt;, or from other items in &lt;code&gt;registryDependencies&lt;/code&gt;. A stray import of a sibling file that is not in the registry installs cleanly and fails at build time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Generating items from source
&lt;/h2&gt;

&lt;p&gt;Hand writing JSON with embedded source strings does not survive the second edit. Facade keeps each item as a folder: &lt;code&gt;registry/items/&amp;lt;slug&amp;gt;/&amp;lt;slug&amp;gt;.tsx&lt;/code&gt; for the component, &lt;code&gt;demo.tsx&lt;/code&gt; for the usage example, and a small &lt;code&gt;meta.json&lt;/code&gt; with title, description, category, tier and tags. A Node script walks the folders and emits everything else.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"name"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"open-now-badge"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Open now badge"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"description"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Live open or closed pill computed from weekly hours in the business's own time zone."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"registry:ui"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"category"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Local business"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tier"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"free"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"dependencies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"motion"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tags"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hours"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"timezone"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"restaurant"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"storefront"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The script reads the imports from the source to confirm the dependency list, counts the lines, extracts the exported component names, and parses the &lt;code&gt;export interface &amp;lt;Name&amp;gt;Props&lt;/code&gt; block so the docs page can render a props table without a separate doc file. The same run writes &lt;code&gt;registry.json&lt;/code&gt;, every &lt;code&gt;/r/&amp;lt;name&amp;gt;.json&lt;/code&gt;, a Markdown page per item and the &lt;code&gt;llms.txt&lt;/code&gt; index. One source, several outputs, and no way for them to disagree.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hosting on Next.js
&lt;/h2&gt;

&lt;p&gt;The item files are static JSON, so any host that serves files works, including a &lt;code&gt;public/&lt;/code&gt; folder. Facade uses a route handler instead, for two reasons.&lt;/p&gt;

&lt;p&gt;The first is licensing. Free items are served to anyone with cache headers. Pro items check the &lt;code&gt;Authorization: Bearer &amp;lt;key&amp;gt;&lt;/code&gt; header against the license API and return 401 with a pointer to the setup docs when it is missing. The shadcn CLI supports per registry headers in &lt;code&gt;components.json&lt;/code&gt;, which is how the &lt;code&gt;@facadeui&lt;/code&gt; namespace works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"registries"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"@facadeui"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://facadeui.com/r/{name}.json"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"headers"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="nl"&gt;"Authorization"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Bearer ${FACADE_LICENSE_KEY}"&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;{name}&lt;/code&gt; placeholder is replaced by the CLI, and &lt;code&gt;${FACADE_LICENSE_KEY}&lt;/code&gt; is read from the consumer's environment, so the key never lands in a committed file.&lt;/p&gt;

&lt;p&gt;The second reason is counting. Every fetch of an item file is one install, because the CLI requests it exactly once per &lt;code&gt;add&lt;/code&gt;. A route handler can record that number per item. A static file cannot.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing with npx shadcn add
&lt;/h2&gt;

&lt;p&gt;From the consumer's side the command is the same one they already use for shadcn's own components, with a URL instead of a name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add https://facadeui.com/r/open-now-badge.json https://facadeui.com/r/opening-hours.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CLI fetches both files, installs &lt;code&gt;motion&lt;/code&gt; if it is missing, makes sure &lt;code&gt;@/lib/utils&lt;/code&gt; exists, and writes the two components to &lt;code&gt;components/facade/&lt;/code&gt;. With the &lt;code&gt;@facadeui&lt;/code&gt; registry configured, the same install is &lt;code&gt;npx shadcn@latest add @facadeui/open-now-badge @facadeui/opening-hours&lt;/code&gt;, and Pro items work the same way.&lt;/p&gt;

&lt;p&gt;After the install, the &lt;a href="https://dev.to/components/open-now-badge"&gt;Open now badge&lt;/a&gt; and the &lt;a href="https://dev.to/components/opening-hours"&gt;Opening hours&lt;/a&gt; list are ordinary files in the project. Change the colors, rename a prop, delete the parts a client does not need. There is no version to upgrade and no breaking change to absorb; if a new version ships, the consumer decides whether to re-add it.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Facade uses the registry with MCP
&lt;/h2&gt;

&lt;p&gt;The registry index is also what the Facade MCP server reads. When an agent calls &lt;code&gt;list_components&lt;/code&gt; it searches the same item list; &lt;code&gt;get_component&lt;/code&gt; returns the Markdown docs with the source for free items, or for Pro items when the request carries a license header; &lt;code&gt;get_install_command&lt;/code&gt; returns the &lt;code&gt;npx shadcn add&lt;/code&gt; line for several items at once; and &lt;code&gt;suggest_page&lt;/code&gt; returns an ordered block list for a business type. Because the MCP server, the docs pages, &lt;code&gt;llms.txt&lt;/code&gt; and the CLI all read the same generated items, an agent sees exactly what a developer sees.&lt;/p&gt;

&lt;p&gt;If you build your own registry, do the same. Generate the item JSON from source, publish the index, add a Markdown view per item, and the agents your users already run will find your components without any extra integration work.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Do I need to publish an npm package?
&lt;/h3&gt;

&lt;p&gt;No. A registry is JSON on a URL. The components ship as source, so there is no package to build, version or publish, and consumers get readable code instead of a compiled bundle. The only npm packages involved are the dependencies your components import.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can a registry item include more than one file?
&lt;/h3&gt;

&lt;p&gt;Yes. &lt;code&gt;files&lt;/code&gt; is an array, and each entry has its own &lt;code&gt;type&lt;/code&gt; and &lt;code&gt;target&lt;/code&gt;. A block can ship a component, a hook and a data file together. Keep imports between those files relative so they resolve after installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I keep private items private?
&lt;/h3&gt;

&lt;p&gt;Serve them from a route handler that checks a license header, and document the &lt;code&gt;components.json&lt;/code&gt; registry entry with the &lt;code&gt;${ENV_VAR}&lt;/code&gt; placeholder so keys stay out of Git. The shadcn CLI sends the configured headers on every fetch, so no extra tooling is needed on the consumer's side.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/shadcn-registry-explained?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-shadcn-registry-explained" rel="noopener noreferrer"&gt;https://facadeui.com/blog/shadcn-registry-explained?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-shadcn-registry-explained&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shadcn</category>
      <category>registry</category>
      <category>nextjs</category>
      <category>tooling</category>
    </item>
    <item>
      <title>Appointment booking slots in React without a backend</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Fri, 06 Nov 2026 14:00:02 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/appointment-booking-slots-in-react-without-a-backend-7c8</link>
      <guid>https://dev.to/marcoschulz123/appointment-booking-slots-in-react-without-a-backend-7c8</guid>
      <description>&lt;p&gt;Most local business sites handle booking with an embed. A Calendly iframe, a Square widget, a third party button that opens a popup in someone else's brand. It works, but it loads a few hundred kilobytes of script, looks nothing like the rest of the page, and the business owner cannot change the copy without logging into another tool. The &lt;a href="https://dev.to/components/booking-slots"&gt;Booking slots&lt;/a&gt; component in Facade is my answer: the whole picking experience rendered in your own React tree, with a single callback at the end that you connect to whatever actually stores the appointment.&lt;/p&gt;

&lt;h2&gt;
  
  
  A 14 day date strip
&lt;/h2&gt;

&lt;p&gt;A calendar grid is the wrong control for a service appointment. Nobody books a haircut for the 23rd of next month. They want "this Thursday" or "the first free Saturday". A horizontal strip of the next two weeks fits that mental model and fits a phone screen.&lt;/p&gt;

&lt;p&gt;The strip is built on mount from today's date forward, &lt;code&gt;days&lt;/code&gt; entries long, with 14 as the default. Each day is a button showing the weekday and the date, and the whole strip is a &lt;code&gt;role="radiogroup"&lt;/code&gt; with one &lt;code&gt;role="radio"&lt;/code&gt; per day, so arrow keys move between days exactly like a native radio group. Closed weekdays, Sundays by default via &lt;code&gt;closedWeekdays={[0]}&lt;/code&gt;, render dimmed with ", closed" appended to their accessible label.&lt;/p&gt;

&lt;p&gt;One small decision makes a big difference: if today has no bookable time left, the component skips ahead and preselects the first day that does. A visitor at 8 pm on a Tuesday lands on Wednesday instead of staring at a grid of disabled buttons. The selected day gets a sliding pill behind it, animated with a &lt;code&gt;layoutId&lt;/code&gt; so it glides between dates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Grouping slots by morning, afternoon and evening
&lt;/h2&gt;

&lt;p&gt;Twenty two half hour slots in one flat list is a wall. Three groups with headings is a menu. The component splits the day's times into Morning (before 12), Afternoon (12 to 5) and Evening (5 onward), and only renders groups that have slots.&lt;/p&gt;

&lt;p&gt;Where do the times come from? A &lt;code&gt;getSlots(date)&lt;/code&gt; function that returns the bookable times for a date as &lt;code&gt;"HH:mm"&lt;/code&gt; strings. The default is 9:00 to 19:30 every 30 minutes, which is a placeholder, not a schedule. Replace it with your real hours:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getSlots&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;saturday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getDay&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;saturday&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;saturday&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;18&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[];&lt;/span&gt;
  &lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="nx"&gt;end&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;)).&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;:&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;padStart&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&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;return&lt;/span&gt; &lt;span class="nx"&gt;out&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;A 45 minute cadence for a 45 minute service means no odd gaps. Because the function receives the date, you can return different grids for different weekdays, or none at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Disabled and taken states
&lt;/h2&gt;

&lt;p&gt;Three things can make a slot unavailable: it is in the past, it is already taken, or the day is closed. The component handles the first and third itself. Past slots on today are disabled with a 30 minute buffer, because nobody can book an appointment that starts in four minutes.&lt;/p&gt;

&lt;p&gt;Taken slots are your data. &lt;code&gt;isSlotDisabled(date, time)&lt;/code&gt; returns true for any time you cannot offer. The default is a stable pseudo random pattern so the demo looks realistic; in production you pass a lookup against your bookings:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;taken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-11-20T10:30&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2026-11-20T11:15&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;isSlotDisabled&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;taken&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;slice&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;10&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;T&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&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;Disabled slots stay visible, dimmed and not clickable, rather than disappearing. A visitor who sees that 10:30 is gone understands the business is busy; a visitor who sees a sparse list wonders if the booking is broken. Above the grid, a small "12 open" counter does the same job in a number.&lt;/p&gt;

&lt;h2&gt;
  
  
  The summary and confirm callback
&lt;/h2&gt;

&lt;p&gt;Below the grid sits a summary line with the service name, the price, the chosen date, time and duration, all from props. It is an &lt;code&gt;aria-live="polite"&lt;/code&gt; region so screen reader users hear the selection change without hunting for it. The confirm button is disabled until a time is picked, then turns green and reads as confirmed after the click.&lt;/p&gt;

&lt;p&gt;The confirm click calls &lt;code&gt;onConfirm&lt;/code&gt; with a tiny object: &lt;code&gt;{ date: "2026-11-20", time: "10:30" }&lt;/code&gt;. The date is an ISO day string, the time is the same &lt;code&gt;"HH:mm"&lt;/code&gt; string your &lt;code&gt;getSlots&lt;/code&gt; returned. That is the entire contract. The component does not know or care what happens next.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wiring it to Cal.com or a webhook
&lt;/h2&gt;

&lt;p&gt;"Without a backend" means the picker has none. The appointment still has to land somewhere, and there are three cheap options.&lt;/p&gt;

&lt;p&gt;The simplest is a webhook. Post the selection plus the visitor's contact details to a Make, Zapier or n8n endpoint, and let the automation create a calendar event and send the confirmation email. For a solo barber this is often all they need.&lt;/p&gt;

&lt;p&gt;The second is Cal.com or a similar scheduling API. Fetch the busy times for the next 14 days from their API in a server component, pass them into &lt;code&gt;isSlotDisabled&lt;/code&gt;, and create the booking in &lt;code&gt;onConfirm&lt;/code&gt; through a route handler. The visitor never sees the third party brand.&lt;/p&gt;

&lt;p&gt;The third is your own database. A &lt;code&gt;bookings&lt;/code&gt; table with a unique constraint on date and time, inserted from a route handler. The unique constraint handles two visitors picking the same slot in the same second; the second insert fails and you show a "just taken, pick another" message.&lt;/p&gt;

&lt;p&gt;Here is the component wired to a route handler, with the visitor's details collected first by the &lt;a href="https://dev.to/components/contact-section"&gt;Contact section&lt;/a&gt; form on the same page:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;use client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BookingSlots&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;BookingSelection&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/booking-slots&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;BookCleaning&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;taken&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;taken&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;takenSet&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;taken&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;BookingSlots&lt;/span&gt;
      &lt;span class="na"&gt;serviceName&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Dental cleaning"&lt;/span&gt;
      &lt;span class="na"&gt;durationMinutes&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;priceLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"$120"&lt;/span&gt;
      &lt;span class="na"&gt;days&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;closedWeekdays&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&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="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;getSlots&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;getSlots&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;isSlotDisabled&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;takenSet&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toISOString&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;slice&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;10&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="s2"&gt;T&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;time&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;confirmLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Request this time"&lt;/span&gt;
      &lt;span class="na"&gt;onConfirm&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selection&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BookingSelection&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="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/book&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;selection&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="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;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;Both components are Pro items. After the one time private registry setup in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&lt;/a&gt;, they install together:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add @facadeui/booking-slots @facadeui/contact-section
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;On a dental site I place the picker right after the team grid, because patients choose a hygienist first and a time second. The full block order is on the &lt;a href="https://dev.to/for/dentist"&gt;dentist page&lt;/a&gt;.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  How do I handle time zones for the slots?
&lt;/h3&gt;

&lt;p&gt;The strip is built with the visitor's local &lt;code&gt;Date&lt;/code&gt;, which is right for a business where visitors and the shop share a zone, which is nearly every local business. If you serve several zones, compute the slot strings on the server in the business zone and label the picker with the zone name.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can visitors book several slots or a range?
&lt;/h3&gt;

&lt;p&gt;Not out of the box; the contract is one date and one time. For a two hour service, return times at two hour intervals from &lt;code&gt;getSlots&lt;/code&gt; instead of asking visitors to pick a range. For recurring bookings, collect the first appointment and let the confirmation flow ask about repeats.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it send confirmation emails?
&lt;/h3&gt;

&lt;p&gt;No. Whatever receives &lt;code&gt;onConfirm&lt;/code&gt; is responsible for emails, calendar invites and reminders. Keeping that out of the component is what lets it drop into any stack.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-appointment-booking-component?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-appointment-booking-component" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-appointment-booking-component?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-appointment-booking-component&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>booking</category>
      <category>localbusiness</category>
      <category>motion</category>
    </item>
    <item>
      <title>Before and after slider in React, accessible and draggable</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Wed, 04 Nov 2026 22:24:40 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/before-and-after-slider-in-react-accessible-and-draggable-3ghi</link>
      <guid>https://dev.to/marcoschulz123/before-and-after-slider-in-react-accessible-and-draggable-3ghi</guid>
      <description>&lt;p&gt;Roofers, painters, landscapers and remodelers all have the same proof: a photo from before the job and a photo from after. Put the two side by side and the eye wanders. Put them in one frame with a handle the visitor drags and the eye follows the handle. That is why the comparison slider earns a spot on every home services site I build, and why I spent more time on the &lt;a href="https://dev.to/components/before-after-slider"&gt;Before / after slider&lt;/a&gt; in Facade than its size suggests. Most of that time went into things you cannot see in a demo: touch, keyboard and screen readers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pointer events, not mouse events
&lt;/h2&gt;

&lt;p&gt;The first version of every comparison slider on the internet listens to &lt;code&gt;mousedown&lt;/code&gt;, &lt;code&gt;mousemove&lt;/code&gt; and &lt;code&gt;mouseup&lt;/code&gt;. Then someone opens it on a phone and nothing happens, so &lt;code&gt;touchstart&lt;/code&gt; and &lt;code&gt;touchmove&lt;/code&gt; get bolted on, and now there are two code paths that drift apart.&lt;/p&gt;

&lt;p&gt;Pointer events replace both. &lt;code&gt;onPointerDown&lt;/code&gt;, &lt;code&gt;onPointerMove&lt;/code&gt; and &lt;code&gt;onPointerUp&lt;/code&gt; fire for mouse, touch and pen with the same event shape, and &lt;code&gt;clientX&lt;/code&gt; means the same thing in all three. The one extra call that makes dragging reliable is &lt;code&gt;setPointerCapture&lt;/code&gt;: once the visitor presses down, the element keeps receiving move events even when the finger or cursor leaves its box. Without it, a fast drag that exits the frame freezes the handle halfway.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;onPointerDown&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PointerEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;&amp;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="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setPointerCapture&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pointerId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;setDragging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;fromClientX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;onPointerMove&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PointerEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;&amp;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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;dragging&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nf"&gt;fromClientX&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;onPointerUp&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;PointerEvent&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;HTMLDivElement&lt;/span&gt;&lt;span class="o"&gt;&amp;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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;hasPointerCapture&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pointerId&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;currentTarget&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;releasePointerCapture&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pointerId&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nf"&gt;setDragging&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&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;&lt;code&gt;fromClientX&lt;/code&gt; reads the container's bounding rect and converts the pointer position into a percentage between 0 and 100. That percentage is the only piece of state. Everything else, the clip, the handle position, the ARIA attributes, derives from it.&lt;/p&gt;

&lt;p&gt;Listen on the whole frame, not just the handle. Visitors tap anywhere on the photo and expect the handle to jump there. A 24 pixel handle as the only hit target is a usability bug on touch screens.&lt;/p&gt;

&lt;h2&gt;
  
  
  The clip-path reveal
&lt;/h2&gt;

&lt;p&gt;The after photo fills the frame. The before photo sits on top of it in an absolutely positioned layer, and &lt;code&gt;clip-path: inset(0 X% 0 0)&lt;/code&gt; cuts that layer off on the right at the handle position. Dragging changes X and the before photo reveals or hides the after photo underneath.&lt;/p&gt;

&lt;p&gt;Clip-path is the right tool because the two images never move or resize. A common alternative is to change the width of the top layer, which stretches the image unless you also counter-scale it, and that path leads to subpixel jitter during a drag. With clip-path both images stay pixel aligned and the browser only repaints the clipped region.&lt;/p&gt;

&lt;p&gt;In the Facade component the value runs through a &lt;code&gt;useSpring&lt;/code&gt; from &lt;code&gt;motion/react&lt;/code&gt; and &lt;code&gt;useTransform&lt;/code&gt; turns the spring into the clip string. The trick is in one effect: while dragging, the spring jumps straight to the value so the handle follows the finger one to one; when the visitor releases or taps somewhere, the spring eases to the new position. Reduced motion users get the jump in both cases.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;spring&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useSpring&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;stiffness&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;damping&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;38&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;mass&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;clip&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useTransform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;spring&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`inset(0 &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;% 0 0)`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;useEffect&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="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;dragging&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;spring&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;jump&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="nx"&gt;spring&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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="nx"&gt;value&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;dragging&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;spring&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Keyboard support with arrow keys
&lt;/h2&gt;

&lt;p&gt;A slider that only works with a pointer is a slider half the audience cannot use. Keyboard support is a single handler on the focusable handle, and it follows the conventions people already know from range inputs:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Left and Down move the handle toward "before", Right and Up toward "after", by &lt;code&gt;step&lt;/code&gt; percent. The default step is 2.&lt;/li&gt;
&lt;li&gt;Shift multiplies the step by 5, so a held shift arrow sweeps the frame in a few presses.&lt;/li&gt;
&lt;li&gt;Page Up and Page Down move by 10.&lt;/li&gt;
&lt;li&gt;Home jumps to 0 and End to 100, the two states a visitor most wants to compare.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Call &lt;code&gt;preventDefault&lt;/code&gt; on the keys you handle so the page does not scroll when someone presses Down with the handle focused. Do not handle keys you do not use; Tab must keep working.&lt;/p&gt;

&lt;h2&gt;
  
  
  The ARIA slider role
&lt;/h2&gt;

&lt;p&gt;Screen reader support is where I see the most comparison sliders fail, and it is not much work. The handle is the one element in the tab order, and it carries:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;role="slider"&lt;/code&gt; with &lt;code&gt;aria-valuemin={0}&lt;/code&gt;, &lt;code&gt;aria-valuemax={100}&lt;/code&gt; and &lt;code&gt;aria-valuenow&lt;/code&gt; set to the rounded value.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aria-valuetext&lt;/code&gt; that reads as a sentence, like "60% before, 40% after", so the announcement means something. A bare "60" does not.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;aria-label&lt;/code&gt; from the &lt;code&gt;label&lt;/code&gt; prop, defaulting to "Before and after comparison", so a page with three sliders announces which one has focus.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The two images are not decorative. When you pass &lt;code&gt;beforeSrc&lt;/code&gt; and &lt;code&gt;afterSrc&lt;/code&gt;, each layer renders an &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; with the &lt;code&gt;beforeAlt&lt;/code&gt; and &lt;code&gt;afterAlt&lt;/code&gt; text, because "Roof before replacement, missing shingles on the south side" is information a sighted visitor gets from the photo. The illustrated fallback that renders without URLs uses &lt;code&gt;role="img"&lt;/code&gt; with the same labels.&lt;/p&gt;

&lt;h2&gt;
  
  
  Touch handling on mobile
&lt;/h2&gt;

&lt;p&gt;Three things break comparison sliders on phones, and all three are fixable with CSS and one attribute.&lt;/p&gt;

&lt;p&gt;First, scrolling. A horizontal drag on a touch screen is also a scroll gesture, and the browser will happily scroll the page while you try to move the handle. &lt;code&gt;touch-action: none&lt;/code&gt; on the frame tells the browser that this element owns its touches. Only set it on the slider, never on the page.&lt;/p&gt;

&lt;p&gt;Second, selection. A long press selects the image or the labels. &lt;code&gt;user-select: none&lt;/code&gt; on the frame prevents it.&lt;/p&gt;

&lt;p&gt;Third, the handle size. The visual handle can be slim, but the hit area is the entire frame thanks to the pointer handlers above, so a thumb never has to land on a two pixel line. The handle itself still gets a 44 pixel circle so it reads as something to grab.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and use
&lt;/h2&gt;

&lt;p&gt;The slider is a Pro item and installs from the private registry once your license key is in &lt;code&gt;components.json&lt;/code&gt; (one time setup in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&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;npx shadcn@latest add @facadeui/before-after-slider
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;BeforeAfterSlider&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/before-after-slider&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;RoofProject&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;BeforeAfterSlider&lt;/span&gt;
      &lt;span class="na"&gt;beforeSrc&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/projects/elm-street/before.jpg"&lt;/span&gt;
      &lt;span class="na"&gt;afterSrc&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/projects/elm-street/after.jpg"&lt;/span&gt;
      &lt;span class="na"&gt;beforeAlt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Roof before replacement, curling shingles and moss on the north slope"&lt;/span&gt;
      &lt;span class="na"&gt;afterAlt&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Roof after replacement, new architectural shingles and copper flashing"&lt;/span&gt;
      &lt;span class="na"&gt;beforeLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Before"&lt;/span&gt;
      &lt;span class="na"&gt;afterLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"After"&lt;/span&gt;
      &lt;span class="na"&gt;defaultValue&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;step&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Elm Street roof replacement"&lt;/span&gt;
      &lt;span class="na"&gt;onValueChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;v&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"max-w-3xl"&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;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;Shoot the two photos from the same spot with the same lens, or the reveal shows a misaligned house instead of a transformed roof. A tripod mark on the driveway is enough. On the &lt;a href="https://dev.to/for/roofer"&gt;roofer page&lt;/a&gt; the slider sits directly under the hero, before the stats, because a roofer's work is the proof and the proof should come before the claims.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Can I use it for staging photos in real estate?
&lt;/h3&gt;

&lt;p&gt;Yes. Empty room before, staged room after, same camera position. It works for renovations, landscaping, dental smile makeovers and anything else with a credible before state. It does not work for stock photos, and visitors can tell.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work with next/image?
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;beforeSrc&lt;/code&gt; and &lt;code&gt;afterSrc&lt;/code&gt; props take plain URLs and render standard images. If you need &lt;code&gt;next/image&lt;/code&gt; for sizing and formats, the source is yours after installation; swap the two &lt;code&gt;&amp;lt;img&amp;gt;&lt;/code&gt; elements and keep the alt text in place.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why a 16 by 10 frame?
&lt;/h3&gt;

&lt;p&gt;The frame uses &lt;code&gt;aspect-ratio&lt;/code&gt; so both photos share one box regardless of their native size, and 16 by 10 fits most exterior and interior shots without cropping the roofline. Override it with a Tailwind &lt;code&gt;aspect-*&lt;/code&gt; class through &lt;code&gt;className&lt;/code&gt;.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-before-after-slider?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-before-after-slider" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-before-after-slider?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-before-after-slider&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>a11y</category>
      <category>motion</category>
      <category>homeservices</category>
    </item>
    <item>
      <title>Opening hours component in React with time zones</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Tue, 03 Nov 2026 11:51:47 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/opening-hours-component-in-react-with-time-zones-1ck6</link>
      <guid>https://dev.to/marcoschulz123/opening-hours-component-in-react-with-time-zones-1ck6</guid>
      <description>&lt;p&gt;The first "Open now" badge I shipped for a client lied. The salon was in Zurich, the site was deployed on servers in the US, and I was testing from my laptop at home. It showed "Open" at 11 pm because somewhere in the chain a date was created in the wrong time zone. That bug is the reason the &lt;a href="https://dev.to/components/opening-hours"&gt;Opening hours&lt;/a&gt; component and the &lt;a href="https://dev.to/components/open-now-badge"&gt;Open now badge&lt;/a&gt; in Facade compute everything in the business's own IANA time zone and never trust the raw clock. Here is how they work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why new Date() on the client is wrong
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;new Date()&lt;/code&gt; gives you the visitor's local time. A visitor in Los Angeles looking at a barber in New York gets a Date whose &lt;code&gt;getHours()&lt;/code&gt; is three hours behind the shop. Compare that to the shop's hours and the badge is wrong for every out of town visitor, which on a site that ranks for the city name is most of them.&lt;/p&gt;

&lt;p&gt;The server is no better. On Vercel or any cloud host the server clock is UTC or whatever region the function runs in. If you render "Open now" on the server, you render it in the server's zone, and the first paint in the browser disagrees with the hydrated one.&lt;/p&gt;

&lt;p&gt;The rule that fixes both: the business has one time zone, it lives in your data, and every comparison happens in that zone. The visitor's zone and the server's zone are irrelevant.&lt;/p&gt;

&lt;h2&gt;
  
  
  Intl and the business time zone
&lt;/h2&gt;

&lt;p&gt;You do not need a date library for this. &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt; accepts a &lt;code&gt;timeZone&lt;/code&gt; option and &lt;code&gt;formatToParts&lt;/code&gt; gives you the weekday, hour and minute in that zone as separate strings. Turn them into a weekday index and minutes since midnight and you have everything a comparison needs:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getZonedNow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="nl"&gt;minutes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;en-US&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;weekday&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;short&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;hour&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;minute&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;numeric&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;hourCycle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h23&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;formatToParts&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;date&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="kd"&gt;get&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;DateTimeFormatPartTypes&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;parts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)?.&lt;/span&gt;&lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;day&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sun&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Mon&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Tue&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Wed&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Thu&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Fri&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sat&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;indexOf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;weekday&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;minutes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hour&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nc"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;minute&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;day&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;minutes&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;&lt;code&gt;hourCycle: "h23"&lt;/code&gt; asks for 0 to 23 hours, and the &lt;code&gt;% 24&lt;/code&gt; guards against engines that still return "24" for midnight. The &lt;code&gt;Date&lt;/code&gt; you pass in is the real current instant; only its presentation changes. This is the whole trick: one instant, interpreted in the shop's zone.&lt;/p&gt;

&lt;p&gt;Both Facade components use exactly this function. The badge even exports it along with &lt;code&gt;getOpenStatus&lt;/code&gt;, so you can compute the status for a schema.org &lt;code&gt;openingHoursSpecification&lt;/code&gt; or a "Closes in 20 minutes" line elsewhere on the page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Split shifts and closed days
&lt;/h2&gt;

&lt;p&gt;Hours data is where most components give up. A salon opens 9 to 1 and 2 to 7. A restaurant closes Mondays. A clinic is open Saturday morning only. The data shape has to express all of that without special cases in the UI.&lt;/p&gt;

&lt;p&gt;Facade uses a weekly map where each day holds an array of ranges. Missing, &lt;code&gt;null&lt;/code&gt; or an empty array means closed. More than one range means a split shift:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;WeeklyHours&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/opening-hours&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;WeeklyHours&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;mon&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;tue&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;09:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;13:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;14:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;19:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;wed&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;09:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;13:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;14:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;19:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;thu&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;09:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;20:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;fri&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;09:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;19:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;sat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;open&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;08:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;close&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;16:00&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;sun&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&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;Times are 24 hour strings. They get parsed into minutes since midnight once, then every comparison is integer math. The list renders "Closed" for a null day and joins the ranges of a split day with a comma. A range that closes after midnight, like a bar open until 02:00, is handled by treating a close time earlier than the open time as belonging to the next day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Highlighting today
&lt;/h2&gt;

&lt;p&gt;Visitors scan the list for one row: today. Highlighting it is the single most useful thing the component does, and it has to use the business zone too. At 11 pm in New York it is already Tuesday in Zurich, so "today" for the Zurich salon is Tuesday.&lt;/p&gt;

&lt;p&gt;The component gets today's index from the same &lt;code&gt;getZonedNow&lt;/code&gt; call and renders a soft pill behind that row. The pill is a &lt;code&gt;motion.div&lt;/code&gt; with a &lt;code&gt;layoutId&lt;/code&gt;, so if the page stays open past midnight it slides to the next row instead of jumping. The row also gets &lt;code&gt;aria-current="date"&lt;/code&gt; so screen readers know which day the highlight means.&lt;/p&gt;

&lt;p&gt;Before the component mounts there is no "today". The component keeps &lt;code&gt;now&lt;/code&gt; as &lt;code&gt;null&lt;/code&gt; on the first render, renders the plain list with a "Loading" status, and fills in today and the status in an effect. That is what makes the server HTML and the first client render identical, which is the hydration mismatch I ran into on that salon site.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;weekStartsOn&lt;/code&gt; prop switches between a Monday first and a Sunday first list. Europe reads Monday first, US customers often expect Sunday first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Live open status without a server
&lt;/h2&gt;

&lt;p&gt;The open status is derived, not fetched. Every 30 seconds an interval updates &lt;code&gt;now&lt;/code&gt;, the component recomputes "is there a range on today that contains the current minute", and the badge flips when the shop opens or closes while the page is open. No API call, no server, no cron.&lt;/p&gt;

&lt;p&gt;The standalone badge adds a third state. With &lt;code&gt;closingSoonMinutes&lt;/code&gt; set, it turns amber and reads "Closing soon" during the last stretch before close. The default is 60 minutes. For a restaurant that stops seating at 9 pm but closes at 10, pass the seating time as the close and keep the default.&lt;/p&gt;

&lt;p&gt;Both components are free and MIT licensed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add https://facadeui.com/r/opening-hours.json https://facadeui.com/r/open-now-badge.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And together on a page, sharing one hours object:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;OpeningHours&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/opening-hours&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;OpenNowBadge&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/open-now-badge&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;hours&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/data/hours&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;HoursSection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;section&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"grid gap-6 md:grid-cols-[1fr_320px]"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;OpenNowBadge&lt;/span&gt; &lt;span class="na"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;hours&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Europe/Zurich"&lt;/span&gt; &lt;span class="na"&gt;closingSoonMinutes&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;size&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"md"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mt-4 text-3xl font-semibold"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Visit the salon&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h2&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;OpeningHours&lt;/span&gt;
        &lt;span class="na"&gt;hours&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;hours&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
        &lt;span class="na"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Europe/Zurich"&lt;/span&gt;
        &lt;span class="na"&gt;weekStartsOn&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mon"&lt;/span&gt;
        &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Hours"&lt;/span&gt;
        &lt;span class="na"&gt;note&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Closed on public holidays."&lt;/span&gt;
      &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;section&lt;/span&gt;&lt;span class="p"&gt;&amp;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;The badge belongs in the hero next to the phone number and in the sticky mobile bar. The full list belongs in the contact section and the footer. I use this exact pairing on the &lt;a href="https://dev.to/for/salon"&gt;salon page&lt;/a&gt;, where "Are you open Sunday?" is the question that decides whether someone calls.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  What about holidays?
&lt;/h3&gt;

&lt;p&gt;Holidays are exceptions, not a schedule, so they do not belong in &lt;code&gt;WeeklyHours&lt;/code&gt;. Keep a small list of dates with their override hours in your data, pick today's override in the business zone, and pass the result as &lt;code&gt;hours&lt;/code&gt;. The &lt;code&gt;note&lt;/code&gt; prop is the place to tell visitors that holiday hours differ.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work for businesses in several locations?
&lt;/h3&gt;

&lt;p&gt;Yes. Each location has its own hours object and its own &lt;code&gt;timeZone&lt;/code&gt; string. Render one &lt;code&gt;OpeningHours&lt;/code&gt; per location, or one badge per location card. Nothing is shared globally.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not render the status on the server for SEO?
&lt;/h3&gt;

&lt;p&gt;Search engines do not index "Open now" as a ranking signal, and a server rendered status would be wrong by the time the page is crawled anyway. Put the schedule itself in &lt;code&gt;openingHoursSpecification&lt;/code&gt; JSON-LD, which is what Google reads, and let the live status be a client concern.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-opening-hours-component?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-opening-hours-component" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-opening-hours-component?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-opening-hours-component&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>localbusiness</category>
      <category>intl</category>
      <category>a11y</category>
    </item>
    <item>
      <title>Real estate website template for Next.js: blocks, not a theme</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Mon, 02 Nov 2026 01:42:21 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/real-estate-website-template-for-nextjs-blocks-not-a-theme-40j8</link>
      <guid>https://dev.to/marcoschulz123/real-estate-website-template-for-nextjs-blocks-not-a-theme-40j8</guid>
      <description>&lt;p&gt;When an agent or a small brokerage asks me for a website, the first thing they send is a link to a theme they found on a marketplace. It looks fine in the demo. Six months after launch it looks like every other brokerage in the state, the listing grid needs a plugin update, and nobody remembers how the contact form sends email. This article is the plan I use instead: a Next.js site assembled from blocks you own, in the order a buyer or seller actually reads a page.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why themes age badly
&lt;/h2&gt;

&lt;p&gt;A theme is one decision made for you, forever. Layout, typography, animation library, form handler and color system arrive as a single bundle. The day you want to change one of them you discover they are all tied together.&lt;/p&gt;

&lt;p&gt;Three problems show up on the themed real estate sites I get asked to fix:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The listing data is shaped for the theme's demo, not for the MLS feed or the spreadsheet the agent actually has. Mapping one to the other becomes a permanent chore.&lt;/li&gt;
&lt;li&gt;The animations are decorative. Things fade in, but nothing on the page responds to the visitor. A buyer who wants to filter by price gets a page reload.&lt;/li&gt;
&lt;li&gt;Lead capture is a generic contact form. Sellers who want to know what their home is worth are the most valuable visitors on the site, and the form treats them like someone asking about parking.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Blocks solve this because each block is a single TypeScript file in your repo. You install the ones you need, pass your data as props, and edit the source when a client wants something specific. There is no theme to update.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 10 block page plan
&lt;/h2&gt;

&lt;p&gt;This is the block order for an agent site. It is the same order I use on the &lt;a href="https://dev.to/for/real-estate-agent"&gt;real estate agent page&lt;/a&gt;, and each block links to its component docs.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://dev.to/components/hero-real-estate"&gt;Hero, real estate&lt;/a&gt;: a full width hero with a Buy, Rent, Sell search panel and animated stats. The search mode changes the labels, so "Location" becomes "Your address" when a visitor switches to Sell and the button turns into "Get valuation".&lt;/li&gt;
&lt;li&gt;Agent card: the agent's name, rating, license and languages, with call, email and tour actions. On an agent site this belongs above the fold on mobile.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/components/property-listing-grid"&gt;Property listing grid&lt;/a&gt;: filterable and sortable listings with saved homes and a Load more button. The grid re-layouts with a spring when a filter changes instead of blinking.&lt;/li&gt;
&lt;li&gt;Stats band: four animated numbers. Homes sold, average days on market, years in business, neighborhoods covered. Use real numbers from the agent or leave the block out.&lt;/li&gt;
&lt;li&gt;Testimonials wall: reviews with names and neighborhoods.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/components/valuation-funnel"&gt;Home valuation funnel&lt;/a&gt;: the seller lead magnet. Five steps, address first, estimate range at the end.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://dev.to/components/mortgage-calculator"&gt;Mortgage calculator&lt;/a&gt;: the buyer tool. I covered the formula and the install in a separate article.&lt;/li&gt;
&lt;li&gt;FAQ section with FAQPage JSON-LD.&lt;/li&gt;
&lt;li&gt;Contact section with a form, hours and a map card.&lt;/li&gt;
&lt;li&gt;Big footer with NAP details, hours and the brokerage license line.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Ten blocks is the whole site. A neighborhood page reuses blocks 3, 4 and 8 with different data.&lt;/p&gt;

&lt;h2&gt;
  
  
  The data shape for listings
&lt;/h2&gt;

&lt;p&gt;Before you touch the hero, decide what a listing looks like in code. The listing grid takes a &lt;code&gt;PropertyListing[]&lt;/code&gt; array, and every other block that shows property data can be fed from the same records.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PropertyListing&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/property-listing-grid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;listings&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PropertyListing&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mls-4108&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;house&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Modern farmhouse with pool&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4108 Avenue G&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hyde Park, Austin&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="nx"&gt;_285_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;beds&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;baths&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;sqft&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3120&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;daysOnMarket&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;New&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;href&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/listings/mls-4108&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;imageSrc&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/photos/mls-4108/cover.jpg&lt;/span&gt;&lt;span class="dl"&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;Two decisions in that shape matter later. &lt;code&gt;type&lt;/code&gt; is a union of &lt;code&gt;"house" | "condo" | "townhome"&lt;/code&gt; because the filter chips in the grid are built from it. &lt;code&gt;status&lt;/code&gt; is optional and limited to &lt;code&gt;"New" | "Open house" | "Price drop" | "Pending"&lt;/code&gt;, because a badge vocabulary that grows without limit ends up with twelve colors nobody can read.&lt;/p&gt;

&lt;p&gt;Where does the array come from? For a solo agent with twenty listings, a JSON file in the repo, updated through a CMS or a spreadsheet export, costs nothing. For a brokerage with an MLS feed, a server component fetches the feed, maps it to &lt;code&gt;PropertyListing&lt;/code&gt; once, and passes the array down. The grid does not care which.&lt;/p&gt;

&lt;p&gt;Rendering the grid is one component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;PropertyListingGrid&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/property-listing-grid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;listings&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/data/listings&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Listings&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;PropertyListingGrid&lt;/span&gt;
      &lt;span class="na"&gt;eyebrow&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Featured homes"&lt;/span&gt;
      &lt;span class="na"&gt;heading&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Homes on the market this week"&lt;/span&gt;
      &lt;span class="na"&gt;listings&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;listings&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;pageSize&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;defaultSort&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"newest"&lt;/span&gt;
      &lt;span class="na"&gt;onToggleSave&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;saved&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;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;Saved homes live in component state. To survive a reload, write to &lt;code&gt;localStorage&lt;/code&gt; in &lt;code&gt;onToggleSave&lt;/code&gt;; restoring the set on load is a small edit to the installed source.&lt;/p&gt;

&lt;h2&gt;
  
  
  The lead capture flow
&lt;/h2&gt;

&lt;p&gt;A real estate site has two visitors with two different questions. Buyers ask "Can I afford this?" and sellers ask "What is my home worth?" Each gets its own block, and the two blocks hand leads to the same place.&lt;/p&gt;

&lt;p&gt;The valuation funnel asks for the address first. That ordering is deliberate: an address is low commitment and feels like the start of a tool, not the start of a form. Property type, size and condition follow, and the contact details come last, after the visitor has invested a minute. The built-in estimator multiplies square footage by a &lt;code&gt;basePricePerSqft&lt;/code&gt; you set for the market, adjusts for condition, and returns a &lt;code&gt;low&lt;/code&gt;, &lt;code&gt;mid&lt;/code&gt; and &lt;code&gt;high&lt;/code&gt; figure. It is clearly labeled as an estimate, not an appraisal, and the &lt;code&gt;estimate&lt;/code&gt; prop lets you swap in a real valuation API later without touching the UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ValuationFunnel&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/valuation-funnel&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ValuationFunnel&lt;/span&gt;
  &lt;span class="na"&gt;marketLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Austin, TX"&lt;/span&gt;
  &lt;span class="na"&gt;basePricePerSqft&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;312&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;onLead&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;estimate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/api/leads&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;estimate&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
  &lt;span class="na"&gt;bookLabel&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Book a walkthrough"&lt;/span&gt;
  &lt;span class="na"&gt;bookHref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"/book"&lt;/span&gt;
&lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;onLead&lt;/code&gt; is where the site earns money. I post to a route handler that writes the lead to the agent's CRM and sends a notification. The mortgage calculator's &lt;code&gt;onChange&lt;/code&gt; callback is the buyer side of the same idea: when a buyer settles on a payment, the pre-approval button next to the donut already knows the numbers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Install and deploy on Vercel
&lt;/h2&gt;

&lt;p&gt;All four featured blocks are Pro items. Set up the private registry once with your license key (the one time setup is in the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&lt;/a&gt;), then install the page in a single command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add @facade/hero-real-estate @facade/property-listing-grid @facade/valuation-funnel @facade/mortgage-calculator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The free blocks on the list, agent card, stats band, FAQ section and the footer, install from the public registry URL, for example &lt;code&gt;npx shadcn@latest add https://facadeui.com/r/agent-card.json&lt;/code&gt;. Every file lands in &lt;code&gt;components/facade/&lt;/code&gt;, depends only on &lt;code&gt;motion&lt;/code&gt; and &lt;code&gt;lucide-react&lt;/code&gt;, and uses the semantic Tailwind tokens your shadcn setup already defines. Change &lt;code&gt;--brand&lt;/code&gt; in &lt;code&gt;globals.css&lt;/code&gt; and the whole site re-themes.&lt;/p&gt;

&lt;p&gt;Deploying is &lt;code&gt;vercel&lt;/code&gt; from the project root or a Git push. Because listings can render on the server, the listing pages are static HTML with the interactive grid hydrating on top. That is what keeps Largest Contentful Paint inside Google's 2.5 second "good" threshold on a phone, which a theme loading several jQuery plugins rarely manages.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Is this a template I can download as a zip?
&lt;/h3&gt;

&lt;p&gt;No. It is an ordered set of blocks you install into your own Next.js project with the shadcn CLI. You get the same result as a template, a complete page, but every section is a file you own and can edit. The order and the data shapes are documented on the industry page.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I connect an IDX or MLS feed?
&lt;/h3&gt;

&lt;p&gt;Yes. Fetch the feed in a server component, map each record to the &lt;code&gt;PropertyListing&lt;/code&gt; type and pass the array to the grid. The grid has no opinion about where the data comes from. IDX compliance rules about attribution and refresh intervals are between you and your MLS.&lt;/p&gt;

&lt;h3&gt;
  
  
  Does it work with the Pages Router or only the App Router?
&lt;/h3&gt;

&lt;p&gt;The blocks are plain React client components. They work in the App Router, the Pages Router, Vite and Remix, as long as Tailwind v4 and the shadcn tokens are set up. The install docs use the App Router because that is what new Next.js projects start with.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/real-estate-website-template-nextjs?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-real-estate-website-template-nextjs" rel="noopener noreferrer"&gt;https://facadeui.com/blog/real-estate-website-template-nextjs?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-real-estate-website-template-nextjs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>realestate</category>
      <category>template</category>
      <category>shadcn</category>
    </item>
    <item>
      <title>How to build a mortgage calculator in React</title>
      <dc:creator>Marco Schulz</dc:creator>
      <pubDate>Sun, 01 Nov 2026 13:09:16 +0000</pubDate>
      <link>https://dev.to/marcoschulz123/how-to-build-a-mortgage-calculator-in-react-4l0p</link>
      <guid>https://dev.to/marcoschulz123/how-to-build-a-mortgage-calculator-in-react-4l0p</guid>
      <description>&lt;p&gt;Every real estate site I have built for a client ended up with the same request about two weeks after launch: "Can we show buyers what the monthly payment would be?" The first time, I wrote the calculator from scratch. The second time, I copied it and fixed the bugs I had shipped the first time. By the fourth site I packaged it as the &lt;a href="https://dev.to/components/mortgage-calculator"&gt;Mortgage calculator&lt;/a&gt; in Facade. This article walks through how it works, so you can build your own or install mine and know what is inside.&lt;/p&gt;

&lt;h2&gt;
  
  
  The payment formula, explained once
&lt;/h2&gt;

&lt;p&gt;A fixed rate mortgage payment is one formula. Everything else in the component is presentation.&lt;/p&gt;

&lt;p&gt;With a loan amount &lt;code&gt;P&lt;/code&gt;, a monthly interest rate &lt;code&gt;r&lt;/code&gt; (the annual rate divided by 12 and by 100) and a number of monthly payments &lt;code&gt;n&lt;/code&gt; (years times 12), the monthly principal and interest payment is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;M = P * r * (1 + r)^n / ((1 + r)^n - 1)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two edge cases matter in code. When the rate is zero, the formula divides by zero, so you return &lt;code&gt;P / n&lt;/code&gt; instead. When the down payment reaches 100 percent, the loan amount is zero and the payment is zero. Both happen the moment a visitor drags a slider to the end, so handle them before you touch any animation.&lt;/p&gt;

&lt;p&gt;In TypeScript:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;monthlyPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loan&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;annualRate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;years&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;years&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loan&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;annualRate&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;loan&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;annualRate&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;pow&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;n&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;loan&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;r&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;f&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&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;Principal and interest are only part of what a buyer pays each month. US buyers expect property tax, homeowners insurance and, for condos, HOA dues on the same screen. Tax is an annual percentage of the home price divided by 12. Insurance is an annual dollar amount divided by 12. HOA is already monthly. The total is the sum of the four, and that total is the number the visitor remembers.&lt;/p&gt;

&lt;h2&gt;
  
  
  Controlled inputs with sliders
&lt;/h2&gt;

&lt;p&gt;The calculator has four inputs: home price, down payment, interest rate and loan term. The first three are range inputs with the formatted value printed next to the label, so a buyer always sees the exact number the slider is on. If you add a text input next to each slider, make both controls write to the same piece of state, which keeps them in sync without effects.&lt;/p&gt;

&lt;p&gt;Down payment is the input that trips people up. Buyers think in percent, lenders think in dollars, and the slider has to show both. Store the percent, derive the dollar amount, and clamp the percent between 0 and 50 so the slider stays useful. A 90 percent down payment is technically valid and practically never happens.&lt;/p&gt;

&lt;p&gt;A few details that make the inputs feel right:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Format the displayed values with &lt;code&gt;Intl.NumberFormat&lt;/code&gt;, not with string concatenation. &lt;code&gt;$1,250,000&lt;/code&gt; reads, &lt;code&gt;$1250000&lt;/code&gt; does not.&lt;/li&gt;
&lt;li&gt;Pick a sensible step for the price slider, a few thousand dollars at least. Pixel precision on a 2 million dollar range is useless.&lt;/li&gt;
&lt;li&gt;Label every range with a visible &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; and an &lt;code&gt;aria-valuetext&lt;/code&gt; that reads the formatted value. Screen readers announce "650,000 dollars", not "650000".&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The 15 or 30 year term toggle
&lt;/h2&gt;

&lt;p&gt;Most calculators put the term in a select. A segmented toggle with two options is faster and shows both choices at once. In Facade it is a small two button group that moves a sliding pill behind the active option, and the payment re-renders the moment it changes. Buyers click it back and forth to feel the difference, which is exactly what you want them doing on a listing page.&lt;/p&gt;

&lt;p&gt;Under the hood it is a &lt;code&gt;role="radiogroup"&lt;/code&gt; with two &lt;code&gt;role="radio"&lt;/code&gt; buttons, arrow keys to switch, and the &lt;code&gt;defaultTerm&lt;/code&gt; prop set to &lt;code&gt;15&lt;/code&gt; or &lt;code&gt;30&lt;/code&gt;. Nothing fancy, but the arrow keys matter: a toggle that only works with a mouse is a bug.&lt;/p&gt;

&lt;h2&gt;
  
  
  A donut breakdown with motion
&lt;/h2&gt;

&lt;p&gt;A single total hides where the money goes. The donut shows four segments: principal and interest, tax, insurance and HOA. Each segment is an SVG circle with a &lt;code&gt;strokeDasharray&lt;/code&gt; for its share and a &lt;code&gt;strokeDashoffset&lt;/code&gt; to position it after the previous segment.&lt;/p&gt;

&lt;p&gt;Animating the segments is where &lt;code&gt;motion/react&lt;/code&gt; earns its place. Each circle's &lt;code&gt;strokeDasharray&lt;/code&gt; and &lt;code&gt;strokeDashoffset&lt;/code&gt; are animated when the values change, so dragging the price slider makes the segments breathe instead of jumping. The total in the middle of the donut uses the same count-up logic as the free &lt;a href="https://dev.to/components/animated-counter"&gt;Animated counter&lt;/a&gt;: it tweens from the previous value to the new one over a few hundred milliseconds, formatted as currency on every frame.&lt;/p&gt;

&lt;p&gt;Two rules I follow for this kind of animation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Animate on change, not on mount only. The first render can animate in, but the interesting moment is the slider drag.&lt;/li&gt;
&lt;li&gt;Respect &lt;code&gt;prefers-reduced-motion&lt;/code&gt;. &lt;code&gt;useReducedMotion()&lt;/code&gt; from motion returns true for those visitors, and the component then sets values directly instead of springing to them.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Install it with the shadcn CLI
&lt;/h2&gt;

&lt;p&gt;The Mortgage calculator is a Pro item, so it installs from the private registry once your license key is in &lt;code&gt;components.json&lt;/code&gt; (the &lt;a href="https://dev.to/docs/installation#pro"&gt;installation docs&lt;/a&gt; show the one time setup).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add @facade/mortgage-calculator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then drop it on a listing page with the listing's price as the default and your market's tax rate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;MortgageCalculator&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;MortgageBreakdown&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@/components/facade/mortgage-calculator&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ListingPayment&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;price&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;price&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;number&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MortgageCalculator&lt;/span&gt;
      &lt;span class="na"&gt;defaultPrice&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;price&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;defaultDownPercent&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;defaultRate&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;6.5&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;defaultTerm&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;propertyTaxRate&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;1.1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;annualInsurance&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1800&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;monthlyHoa&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;title&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Estimate your monthly payment"&lt;/span&gt;
      &lt;span class="na"&gt;onChange&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;MortgageBreakdown&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="c1"&gt;// result.total, result.principalAndInterest, result.propertyTax, result.insurance, result.hoa, result.loanAmount&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;/&amp;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;The &lt;code&gt;onChange&lt;/code&gt; callback hands you the full breakdown on every change. I use it to update a "Payment from $X per month" line in the sticky header of the listing page, and some agents use it to prefill a pre-approval request.&lt;/p&gt;

&lt;p&gt;If you only need the count-up number without the calculator, the Animated counter is free and MIT licensed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx shadcn@latest add https://facadeui.com/r/animated-counter.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Where it belongs on a real estate site
&lt;/h2&gt;

&lt;p&gt;On a listing page, the calculator goes directly under the key facts, before the photo gallery ends and the agent card appears. Buyers scroll to the price, then to the payment, then decide whether to keep reading. On a brokerage home page it earns less, because there is no price to anchor it to. The block order I use for agent sites is on the &lt;a href="https://dev.to/for/real-estate-agent"&gt;real estate agent page&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;One thing I do not do: pull live rates from an API. Rates change daily, the calculator becomes a compliance question, and buyers understand that 6.5 percent is an example. Set a sensible default, let them change it, and put a one line disclaimer under the donut.&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Does the calculator include PMI?
&lt;/h3&gt;

&lt;p&gt;No. Private mortgage insurance depends on the lender and the loan program, and a wrong PMI number is worse than none. If your market needs it, add it as a fifth monthly line in the &lt;code&gt;onChange&lt;/code&gt; consumer or extend the component; the source is yours after installation.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use it outside the US?
&lt;/h3&gt;

&lt;p&gt;Yes. The formula is universal for fixed rate loans. Pass &lt;code&gt;monthlyHoa={0}&lt;/code&gt;, set &lt;code&gt;propertyTaxRate&lt;/code&gt; to your local rate or 0, and format currency with your own &lt;code&gt;Intl&lt;/code&gt; locale in the consuming component. The labels are props, so "HOA" can become "Service charge" or disappear.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why not use a mortgage calculator embed from a lender?
&lt;/h3&gt;

&lt;p&gt;Embeds load a third party script, carry the lender's branding, and often break Core Web Vitals on mobile because they inject an iframe above the fold. A component you own renders as part of the page, inherits your theme tokens and sends leads to you, not to the lender.&lt;/p&gt;




&lt;p&gt;Originally published at &lt;a href="https://facadeui.com/blog/react-mortgage-calculator?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-mortgage-calculator" rel="noopener noreferrer"&gt;https://facadeui.com/blog/react-mortgage-calculator?utm_source=devto&amp;amp;utm_medium=social&amp;amp;utm_campaign=art-react-mortgage-calculator&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>realestate</category>
      <category>motion</category>
      <category>shadcn</category>
    </item>
  </channel>
</rss>
