Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some UI elements not appearing on HTML page #1

Open
hsharghi opened this issue Sep 2, 2024 · 0 comments
Open

Some UI elements not appearing on HTML page #1

hsharghi opened this issue Sep 2, 2024 · 0 comments

Comments

@hsharghi
Copy link

hsharghi commented Sep 2, 2024

I used vercel-starter-kit and it worked as expected. Print some HTML text. But as I tried to add some Button and TextField it's not showing up in the rendered HTML page.

import Vercel
import VercelUI

struct App: ExpressHandler {
    static func configure(router: Router) async throws {
        router
            .get("/", IndexPage())
    }
}


struct IndexPage: View {
    
    @Environment(\.request) var req
    @State var name: String = ""
    
    var body: some View {
        VStack {
            TextField("Enter your name", text: $name)
            Button("Click Me!", action: {
                print("clicked")
            })
            Text("Hello, Swift")
                .font(.title)
            
            Text("This is a server rendered SwiftUI website")
                .font(.subheadline)
            
            Text("Your ip address \(req.clientIPAddress)")
        }
    }
}
Screenshot 2024-09-03 at 02 47 06

The output is just text without input field or button

What am I doing wrong?

@github-staff github-staff deleted a comment from hsharghi Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@hsharghi and others