Background
I have a small Phoenix 1.7 app where I am trying to add a radial progress bar, using the default TailwindUI components: https://tailwindui.com/components
Unfortunately for me, I was only able to find normal progress bars:
https://flowbite.com/docs/components/progress/
Namely:
<div class="w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700">
<div class="bg-blue-600 h-2.5 rounded-full" style="width: 45%"></div>
</div>
The only radial progress bar I found was one using DaisyUI:
https://daisyui.com/components/radial-progress/
However, I want to avoid installing anything extra, I really just want to use the default tailwindUI and tailwindCSS that come with Phoenix 1.7
Questions
- Does someone know how to create a a radial progress bar component using the default setup that comes with Phoenix LiveView 1.7?
- Am I missing some component that already does this?
2
Answers
Answer
By checking some examples using Tailwind with Apline.js I was able to analyze the code and create a component that does exactly what I want.
This code uses only Phoniex LiveView vanilla, no extra CSS no extra anything !
core_components
:Usage in
my_app_live.heex.html
:Will produce the following:
For more information on how I created this, feel free to check the whole story on the elixir's forum thread:
https://elixirforum.com/t/radial-progress-bar-using-tailwinui/58098/10?u=fl4m3ph03n1x
I think you may have to write some custom CSS and spice it up with your tailwind classes.
You can check this gist for a custom-made circular progress bar using Tailwind.
Basically, here’s what you need:
I hope this helps. Goodluck!