Use Components to Keep Your User Interface Clean

It’s important to give your users consistent style and interaction across your application. Your buttons, modals, lists, tables, and so on should all feel like they belong together. This is done by using consistent CSS styles and JavaScript code across your frontend. You could do this by ensuring perfect HTML and CSS class usage across your application, but that’s bound to have inconsistencies appear. Of course, Phoenix supports a better way—components.

Components are self-contained HTML templates, but they offer benefits over normal HTML. Components let you define the attributes that are required to use them, so you can be sure they’re used in the proper way across your app. They can do a lot ...

Get From Ruby to Elixir now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.