What is a "dot link" tag: `<.link ...></.link>`?

I was reading about Phoenix verified routes in the docs, and there is this code:

<.link href={~p"/sessions/new"} method="post">Sign in</.link>

I tried searching around, but I couldn’t find any information about that “leading dot”.

That’s shorthand for either a locally defined function component or more commonly an imported function component module with use Phoenix.Component.

https://hexdocs.pm/phoenix_live_view/Phoenix.Component.html

3 Likes