Extensible Phoenix liveview components, without boilerplate
PhxComponentHelpers is a library that provides helper functions designed to improve the configurability and extensibility of Phoenix LiveView components from templates. It aims to simplify the development of stateless components by reducing the amount of boilerplate code required. The library offers features such as setting HTML, data, or phx attributes from component assigns, validating mandatory attributes, and extending CSS classes from component assigns. PhxComponentHelpers is intended to work well with the PETAL stack, which consists of Phoenix, Elixir, TailwindCSS, Alpine.js, and LiveView.
To install PhxComponentHelpers, follow these steps:
Add the following line to your mix.exs file in the deps function:
{:phx_component_helpers, "~> x.x.x"}
Replace x.x.x with the desired version of PhxComponentHelpers.
Run the following command in your terminal to fetch the dependency:
mix deps.get
Once the dependency is fetched, you can start using PhxComponentHelpers in your Phoenix LiveView project.
PhxComponentHelpers is a library that provides helper functions for Phoenix LiveView, making it easier to create configurable and extensible components from templates. It offers features such as setting attributes, validating mandatory attributes, and extending CSS classes from component assigns. The library is designed to work well with the PETAL stack (Phoenix, Elixir, TailwindCSS, Alpine.js, LiveView) and aims to improve developer productivity and consistency in UI and code. Compared to other libraries like Surface, PhxComponentHelpers focuses more on providing syntactic sugar and helper functions rather than being a comprehensive UI framework.