How to make HTML components in Phoenix

I am using tailwind css. Due to code duplicity, I want to use it as components. How to achieve that in clean way? I want to import the components and use it anywhere.

You can check how I did here:

I end up with something like:

<%= card do %>
    <%= card_header do %>
      The Coldest Sunset
  <% end %>
  <%= card_body do %>
      <p class="text-gray-700 text-base">
        Lorem ipsum dolor sit amet, consectetur adipisicing elit. Voluptatibus quia,
      nulla! Maiores et perferendis eaque, exercitationem praesentium nihil.
    </p>
  <% end %>
<% end %>

But there is also partials and view helpers that you can write.

3 Likes