8/25/2023 0 Comments Elixir phoenix liveviewLet’s rewrite the above with a function component and slot: Function components and slots solve this issue by allowing components to declare named slots where the caller can provide arbitrary content to named sections such as a modal title, header, or footer. The standard template model breaks down in terms of composability. This fails because Phoenix performs HTML escaping on strings, so we’d need to carefully unpack our own HTML input. We end up trying to concat raw HTML string together and it’s a nonstarter: file" } is ready!" ) do %> This is simple enough, but the issue comes when we want to place arbitrary content inside our modal title, such as a link to the download. The file will only be available for 10 minutes Prior to function components, you would write your Elixir template like this: Let’s say we have a modal component in our application and we want to call it. To understand why these features are a such a big deal, let’s take a look at a simple function component. We also shipped a new mix formatter plugin for formatting HEEx templates, which is something you can’t live without after using it. These new features take function components to the next level to provide a truly first-class composable component system.Īdditionally, new out-of-the-box focus components and JS commands provide accessibility improvements to ensure LiveView applications work well for all users. Declarative assigns and slots provide compile-time warnings and enhanced docs that make building out your own UI or consuming UI libraries such a pleasant experience. We’ve been working on some game-changing features for LiveView 0.18.0. Posted on September 21st, 2022 by Chris McCord
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |