<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Web Components Lab]]></title><description><![CDATA[Web Components Lab]]></description><link>https://likithakattamudi.hashnode.dev</link><image><url>https://cdn.hashnode.com/uploads/logos/69eb64374e3c7463dba29b1e/a22186a9-a348-4b67-9613-bd7fa953330b.svg</url><title>Web Components Lab</title><link>https://likithakattamudi.hashnode.dev</link></image><generator>RSS for Node</generator><lastBuildDate>Thu, 12 Nov 2026 07:55:55 GMT</lastBuildDate><atom:link href="https://likithakattamudi.hashnode.dev/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Build Once, Use Everywhere: Creating Reusable UI Components with Lit & Storybook]]></title><description><![CDATA[Learn how to build reusable UI components using Lit and Storybook and publish them for cross-framework usage.]]></description><link>https://likithakattamudi.hashnode.dev/build-once-use-everywhere-creating-reusable-ui-components-with-lit-storybook</link><guid isPermaLink="true">https://likithakattamudi.hashnode.dev/build-once-use-everywhere-creating-reusable-ui-components-with-lit-storybook</guid><category><![CDATA[Web Components]]></category><category><![CDATA[Storybook]]></category><category><![CDATA[Frontend Development]]></category><category><![CDATA[#UIComponents]]></category><dc:creator><![CDATA[Likitha Kattamudi]]></dc:creator><pubDate>Wed, 29 Apr 2026 17:55:30 GMT</pubDate><enclosure url="https://cdn.hashnode.com/uploads/covers/69eb64374e3c7463dba29b1e/cba37f7c-266f-4d1f-b93c-408f1f4fcdd1.jpg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2>🚀 Introduction</h2>
<p>Modern UI development often ties components to specific frameworks like React or Angular. This leads to duplicate development, inconsistent design, and increased maintenance effort.</p>
<p>To solve this, a framework-independent approach using Web Components can help build reusable and scalable UI elements.</p>
<hr />
<h2>💡 Solution Overview</h2>
<p>This approach uses:</p>
<ul>
<li><p>Lit (Web Components) to build reusable UI components</p>
</li>
<li><p>Storybook for interactive testing</p>
</li>
<li><p>npm packages for sharing components across applications</p>
</li>
</ul>
<p>This allows building components once and using them across multiple frameworks.</p>
<hr />
<h2>🏗️ Architecture Flow</h2>
<p>The workflow looks like this:</p>
<ul>
<li><p>Developer creates reusable components using Lit</p>
</li>
<li><p>Components are documented and tested in Storybook</p>
</li>
<li><p>Components are built and published as npm packages</p>
</li>
<li><p>Applications (React, Angular, Vue) consume these components</p>
</li>
</ul>
<img src="https://cdn.hashnode.com/uploads/covers/69eb64374e3c7463dba29b1e/dc63db62-a0af-4a51-8f1b-8eebe8c743a5.png" alt="" style="display:block;margin:0 auto" />

<p><img src="align=%22center%22" alt="" /></p>
<hr />
<h2>🧩 Example: Lit Component</h2>
<pre><code class="language-typescript">@customElement('my-button')
export class MyButton extends LitElement {
  @property() label = 'Click Me';

  render() {
    return html`&lt;button&gt;${this.label}&lt;/button&gt;`;
  }
}
</code></pre>
<pre><code class="language-html">&lt;my-button&gt;&lt;/my-button&gt;
&lt;my-button label="Submit"&gt;&lt;/my-button&gt;
</code></pre>
<hr />
<h2>📘 Storybook Integration</h2>
<p>Storybook helps in:</p>
<ul>
<li><p>Viewing components in isolation</p>
</li>
<li><p>Creating different states (Primary, Disabled, etc.)</p>
</li>
<li><p>Acting as live documentation</p>
</li>
</ul>
<hr />
<h2>📘 Live Storybook Demo</h2>
<p>You can explore reusable UI components and their variations through the live Storybook:</p>
<p>👉 <a href="https://likitha-kattamudi-31.github.io/Praval-UI-Components/"><strong>View Storybook</strong></a></p>
<p>This includes:</p>
<ul>
<li><p>Interactive component previews</p>
</li>
<li><p>Different states and variations</p>
</li>
<li><p>Real-time property controls</p>
</li>
</ul>
<hr />
<h2>📦 <strong>Publishing Components</strong></h2>
<pre><code class="language-shell">npm run build
npm publish
</code></pre>
<p>Update:</p>
<pre><code class="language-shell">npm version patch
npm run build
npm publish
</code></pre>
<h2>🔗 Consuming Components</h2>
<p>Components can be published either <strong>privately using Azure Artifacts</strong> or <strong>publicly via npm</strong>, depending on your use case.</p>
<hr />
<h3>🔐 Using Azure Artifacts (Private Packages)</h3>
<p>Configure your <code>.npmrc</code>:</p>
<pre><code class="language-shell">@your-scope:registry=https://&lt;company-registry-url&gt;
always-auth=true
</code></pre>
<p>Authenticate and install:</p>
<pre><code class="language-shell">vsts-npm-auth -config .npmrc
npm install component-name
</code></pre>
<p>👉 Used for internal enterprise projects where components are shared within the organization.</p>
<hr />
<h3>🌐 Using npm (Public Packages)</h3>
<p>If components are published publicly:</p>
<pre><code class="language-shell">npm install component-name
</code></pre>
<p>👉 Used for open-source or publicly reusable component libraries.</p>
<hr />
<h2>📊 Benefits</h2>
<ul>
<li><p>Eliminates duplicate UI development</p>
</li>
<li><p>Improves consistency across applications</p>
</li>
<li><p>Reduces development and maintenance effort</p>
</li>
<li><p>Enables faster development cycles</p>
</li>
<li><p>Supports cross-framework usage</p>
</li>
</ul>
<hr />
<h2>📈 Conclusion</h2>
<p>Lit, Storybook, and npm together redefine UI development—enabling teams to build once, reuse everywhere, and deliver faster with consistency and scalability at the core.</p>
<p>💡 If you found this useful, explore the Storybook demo and try integrating these components into your projects.</p>
<p>✍️ Written by <strong>Likitha Kattamudi</strong></p>
]]></content:encoded></item></channel></rss>