i have created a custom component library using Lit Elements ,
now i'm tasked to write wrappers for same to use in elixir phoenix projects
by following core_components.ex , i have written a wrapper for a component ,
but none of phx-hooks seems to be working (i tried replacing login button from demo login page of gen.auth )
how to write these for phx-hooks
my wrapper for my button
defmodule PhoenixWrapperComponentsWeb.MyButton do use Phoenix.Component slot :inner_block attr :id, :any, default: nil, doc: "ID of the button" attr :name, :any, default: nil, doc: "Name of the button" attr :variant, :string, default: "primary", values: ~w(primary secondary tertiary ghost), doc: "variant of button" attr :type, :string, default: "primary", doc: "Variant of color: primary, extra, success, error, info, neutral" attr :icon_1, :string, default: nil, doc: "Icon displayed on the left side of the button" attr :icon_2, :string, default: nil, doc: "Icon displayed on the right side of the button" attr :label, :string, default: nil, doc: "Label of the button" attr :size, :string, default: "md", doc: "Size of the button: xxs, xs, sm, md, lg, xl, xxl" attr :gif_1, :string, default: nil, doc: "GIF on the left side of button label" attr :gif_2, :string, default: nil, doc: "GIF on the right side of button label" attr :rest, :global, include: ~w(disabled form name value) @doc """ A wrapper component for the `my-button` web component. """ @spec mybutton(map()) :: Phoenix.LiveView.Rendered.t() def mybutton(assigns) do ~H""" <my-button id={@id} name={@name} variant={@variant} type={@type} icon_1={@icon_1} icon_2={@icon_2} label={@label} size={@size} gif_1={@gif_1} gif_2={@gif_2} {@rest} > <%= render_slot(@inner_block) %> </my-button> """ end end
phoenix default button in core_components.ts
@doc """ Renders a button. ## Examples <.button>Send!</.button> <.button phx-click="go" class="ml-2">Send!</.button> """ attr :type, :string, default: nil attr :class, :string, default: nil attr :rest, :global, include: ~w(disabled form name value) slot :inner_block, required: true def button(assigns) do ~H""" <button type={@type} class={[ "phx-submit-loading:opacity-75 rounded-lg bg-zinc-900 hover:bg-zinc-700 py-2 px-3", "text-sm font-semibold leading-6 text-white active:text-white/80", @class ]} {@rest} > xxx<%= render_slot(@inner_block) %> </button> """ end usage : <:actions> <.mybutton label="Create an account" phx-click="go"></.mybutton> <.button phx-click="go" class="w-full">Create an account</.button> <.button phx-disable-with="Creating account..." class="w-full">Create an account</.button> </:actions>
Hi community, I would like to know how to config my neovim for suggest html completions in Elixir file.
Current, I'm using the plugin and html lsp (configured with Mason).
I tried to add elixir as a file type to html lsp, even that nothing change.
local html_capabilities = vim.lsp.protocol.make_client_capabilities() capabilities.textDocument.completion.completionItem.snippetSupport = true lspconfig.html.setup({ capabilities = html_capabilities, filetypes = { "html", "templ", "elixir" }, init_options = { configurationSection = { "html", "css", "javascript", "elixir", "eelixir", "heex", "surface" }, embeddedLanguages = { css = true, javascript = true, elixir = true, eelixir = true, heex = true, }, provideFormatter = true, }, })
Anyone know how to solve that ?
I am new to Elixir and after working with typescript, Python, and Java I have to say that it’s a breath fresh air. It’s just so pretty and fun to work with.
And working with phoenix feels like touching a piece of art. I mean, it goes down to the level of defining transactions! Prisma what?
It feels so nice to use something built by people who truly treat coding like an art — despite how functional it is.
Elixir seems to be perfect for real-time-heavy platforms with high concurrency needs like chat websites, and messaging apps. But is it suitable for running huge social media platforms like Reddit, Tumblr or Twitter? If someone were to build Reddit's backend from scratch today, would Elixir be a good choice, compared to something like Node or Golang?
When looking into Ash, I realized it essentially provides the same thing Phoenix does. Both center around the idea of a resource. Both provide conveniences to define/generate one, which includes the struct, the schema, the context methods to manipulate the data in your database and the http endpoints (in case of Phoenix).
Yet Ash promotes itself as a complement to Phoenix, not a substitute.
Are there anyone here using Ash with Phoenix? Did you find it to be a force multiplier? What's the most useful feature of Ash in the Phoenix context?
hello again! I recently posted 2 weeks ago that I was doing the Stephen Grider udemy course and stopped right after the identicon generator project (the next part was phoenix and I was advised to skip it since its a very old phoenix)
so, I still didn't start learning phoenix yet instead I chased a shiny object (NIFs) and ported that identicon project to rust, and then used rustler to play around with NIF implemtation. Surpsingly very simple! felt like cheating haha!
My rust approach was very naiive but with the NIF and I got about a ~70x speedup according to . Not that I was strapped for time or anything :p, and I am sure there could be further improvements, but this was a fun project as is and scratched my itch to also improve my rust skills as well.
So now I have an actual phoenix project idea in mind- I want to basically create a simple phoenix web app that generates identicon images with user input. (probably something identical to which generates an identicon on every key press event)
I might be googling the wrong things, but I can't seem to find any indication that you can use NIFs with phoenix? Before I jump into this and go crazy wasting time, I wanted to ask here if it is indeed possible to an elixir NIF project with phoenix?
Hello,
Trying to use LiveBook to test implementing integration but I need to use OAuth flow.
Is it possible to use it? If so how with callback urls?
Thanks.
In reading the Phoenix docs on layouts, it seems like the reason for a root_layout and a standard layout is the root_layout only gets rendered once, when the page is first rendered, while the app.html.heex gets rendered every time. Ok, I get this. But why then does the root.html.heex and the app.html.heex both contain menu items by default, creating this weird stacked menu? Is this something that people just immediately rip out?
Also, I don't really get why app.html.heex is the default layout for any LiveView page. Wouldn't you want say a different layout for say the login page versus the page after someone was authenticated vs a completely separate page for an unauthenticated user? Why do all these default to a single layout? Is it common for people to customize the macros in their MyAppWeb so theirs something like a :public_view
versus a :login_view
versus an :authenticated_view
, so some pages have the menu you'd display when you're authenticated vs. not authenticated? Or do you just wrap a test for the right menu to display depending on the user's authenticated status?
Basically, I'm confused by the Phoenix layout system...
We're thrilled to announce the Virtual Elixir Exchange: Collaborate, Innovate, and Connect - an online event where the vibrant Elixir community comes together to share, learn, and grow!
đź—“ Date: 24th July
đź•’ Time: 6 PM EEST đź’» Where:
What to Expect: 🔹 Showcase your latest Elixir projects and innovations.
🔹 Network with fellow developers, professionals, and enthusiasts passionate about Elixir.
Whether you're working on groundbreaking applications, seeking your next career move, or simply eager to connect with like-minded individuals, this event is for YOU!
Don't miss out on this fantastic opportunity to collaborate, innovate, and grow within our dynamic Elixir community.
I need a really really small realtime portable backend, i was looking into supabase’s elixir implementation and pocketbase, im quite tight with the RAM, i have 512MB destined for the service, it needs to host as much users as it can, for reference pocketbase can host up to 10,000 concurrent realtime users with the minimum requirements (256 ram)
Let me preface i have very little web dev experience aside from a couple of super basic flask apps back in the day. I am also pretty new to elixir but man it is a breath of fresh air after working with python and nodejs for years.
Anyway, at work we have a few application we run benchmark tests in CI, as a side hacking thingy i wanted to build a basic dashboard that can display these benchmark scores over time(so, timeseries data, TBD if these need to be interactive graphs). We have a really old (similar) internal dashboard someone made with js years ago and knowledge on this code base is long gone. It’s useful at times but very very janky.
I moreso wanted to make a lite version of this dashboard with elixir & phoenix (would i need liveview?) and for personal use at work to quickly do some visualization + additional features if needed. But display of the data over custom time ranges is the main thing here.
Is phoenix good for this? I did a quick perusal and didnt see much charting libraries. Theres vegalite which looked fantastic but seems to be specifically for livebook, then i saw theres Contex but doesnt seem to have much active development?
Heya! I'm porting a legacy code while maintain compatibility with it, but i have see that it uses Rijndael with 256 bits of key and IV in CBC mode, there's a Elixir or Erlang package that supports this configuration? Rijndael with 256 bits of IV.
Hi! I was watching the , and it got me thinking about the several ways of doing something in Elixir. For example, flow control, and conditional behavior: we have pattern matching, cases and conds, if and unless, with statements, etc. Or how about functions, how "single concern" or atomic should we make them?
Now, I know the Clean Code discussion is inherently O.O.P. related, but I was hoping there's maybe some similar work done for Elixir or F.P. in general, especially for recommending best practices, preferred idioms, and perhaps most importantly, how much our choices impact the performance or our apps
I am building a in store information system that is going to be deployed across a couple hundred locations. It should work both as an app and on desktop through a browser and will essentially be a CRUD-app.
-
Does it make sense to build the web-frontend in liveview if the mobile app is being built with flutter? Is it easier to just build one REST-api and use react as the web frontend/flutter for the app?
-
Liveview uses websockets rather than a REST-api. Is that an issue if I have a website or app running for an entire working day?