<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="361697" data-post-id="361697">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="phcurado" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/phcurado/120/39030_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  phcurado
                      <span class="op-star" title="Thread Starter">
                        <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                      </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/bdarla" rel="nofollow">@bdarla</a></p>
<p>That’s a very good question and depending on the component it may seen that both approaches are similar - wrapping the component using phoenix attributes or using the classes directly.<br>
The advantage of using <code>DaisyUIComponents</code> is that it is using attributes and slots to change component behavior. For the Avatar example, if you want to make your user to have the online attribute, should be straightforward using the library</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;.avatar online={@user.online == true}&gt;
    &lt;div class="w-16 rounded-full"&gt;
        &lt;img src="..." /&gt;
    &lt;/div&gt;
&lt;/.avatar&gt;
</code></pre>
<p>Now if you are using daisyui without wrapping in a component, it’s a bit more hard to customize the behavior of a component because you have to add/remove classes based on your data:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">&lt;div class={["avatar", @user.online &amp;&amp; "avatar-online"]}&gt;
    &lt;div class="w-16 rounded-full"&gt;
      &lt;img src="..." /&gt;
    &lt;/div&gt;
&lt;/div&gt;
</code></pre>
<p>Avatar is a really simple component so it might not seem that it will bring a lot of benefits but if you get a more complex case of modifying a component behavior based on your data , you will end up creating a lot of <code>ifs</code> in your component to remove or add classes to simulate this behavior.<br>
We can see more value in more complex components such as <code>table</code> which can use  <code>col</code> as slots, creating both the header and body on a single slot will make the code more easier and clean to read.</p>
<p>The library should be fully compatible with the new phoenix release, I created a <a href="https://github.com/phcurado/daisy_ui_components/tree/feat/tailwind-4-docs" rel="noopener nofollow ugc">branch</a> with a new Readme description on how to use it and I will merge as soon as the new phoenix version is officially released.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="361697" data-batch-url="/posts/batch_likers">
                        3
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/daisyuicomponents-a-phoenix-liveview-daisyui-library/69415/22">Post #21</a>
	                </div>
	            </div>
              <div id="likers-container-361697" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="361697"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>