Having trouble creating a clickable button in Phoenix LiveView Native

38 Views Asked by At

Im using Phoenix LiveView Native (beta 1) and am having trouble creating a button. here is my code below.

defmodule MyApp.HomeLive do
  use MyApp, :live_view
  use MyApp.HomeStyles
 

  def render(%{format: :swiftui} = assigns) do
    ~SWIFTUI"""
    <VStack class="">
      <Button />
      Sign Up
    </VStack>
    """
  end
end
1

There are 1 best solutions below

0
Verty00 On

Here is what I ended up doing

defmodule MyApp.HomeLive do
  use MyApp, :live_view
  use MyApp.HomeStyles
 

  def render(%{format: :swiftui} = assigns) do
    ~SWIFTUI"""
    <VStack class="">
      <Button phx-click="inspect" class="button">Sign Up</Button>
    </VStack>
    """
  end
end

# Styles

defmodule MyApp.HomeStyles do
~SHEET"""
"button" do
  buttonStyle(.bordered)
  buttonBorderShape(.roundedRectangle(radius: 5))
end
"""
end