Change LoginSignupForm
Hey there, how can I change the UI for the Login/Signup form in WASP (the built-in one) .
10 Replies
Hi @Gus. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
Wohooo @Gus, you just became a Waspeteer level 2!
----------------------
You can customize the built-in Login and Signup forms in Wasp in several ways:
Basic Customization
Wasp provides props you can pass to all auth forms:
1.
appearance
- customize colors via design tokens
2. logo
- add your own logo
3. socialLayout
- control layout of social buttons (vertical/horizontal)
Here's an example of customizing colors:
Advanced Customization
If you need more control, you have two options:
1. Customize the signup process: You can add extra fields or UI elements by following the instructions in the Auth Overview documentation.
2. Create your own forms: For complete control, you can build your own forms using Wasp's lower-level auth primitives:
You'll need to implement the userSignupFields
function as described in the Auth Overview documentation.
Important Note
Never modify files under .wasp/out/
directory as mentioned in a Discord support thread. These are generated files and modifying them can cause problems.
If you need to implement custom behavior, create new files within your src/server
directory instead.
Sources:
Auth UI Documentation
Auth Overview Documentation
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Gus, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai if I want to add translations to some elements of the login/signup forms, what would be the best way to do it?
Let me check the knowledge base for you again. One moment! :books:
----------------------
Based on the knowledge sources provided, there isn't specific documentation about adding translations to the built-in login/signup forms in Wasp. However, I can suggest a few approaches based on the customization options available:
Option 1: Create Custom Forms
The most flexible approach would be to create your own custom login and signup forms instead of using the built-in ones. This gives you complete control over all text elements:
As mentioned in a Discord support thread, you can import the
login
and signup
functions from "wasp/client/auth" and build your own form while still using Wasp's authentication logic.
Option 2: CSS Hacks (Not Recommended)
Some users have resorted to CSS hacks to hide default elements and replace them with custom ones. As seen in a Discord thread, one user applied CSS to hide the default title:
Then they added their own translated elements around the form. This is hacky and not recommended for production use.
Option 3: Wait for Enhanced Customization
The Wasp team has acknowledged the need for more customization options for auth forms. There's an open GitHub issue (#1617) to make the signup form more flexible in future versions.
For now, the best approach is likely Option 1 - creating your own forms using Wasp's auth primitives, which gives you full control over all text elements while still leveraging Wasp's authentication logic.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Gus, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?@kapa.ai I went the custom form route, but then how can I correctly add the Google Auth option?
Let me check the knowledge base for you again. One moment! :books:
----------------------
I can help you add Google Auth to your custom form. Wasp provides specific UI helpers for social authentication that you can use in your custom implementation.
Adding Google Auth to Your Custom Form
You can use the built-in Google sign-in button or URL provided by Wasp:
The
GoogleSignInButton
is a pre-styled button that handles the Google authentication flow, while googleSignInUrl
is the URL that initiates the Google OAuth process, which you can use with your own custom button or link Auth Social Overview.
Setting Up Google Auth in Your Wasp File
Make sure you've properly configured Google Auth in your main.wasp
file:
This enables Google authentication with the default settings Google Auth Setup.
Customizing the Google Auth Flow
If you need to customize the Google authentication flow (like adding extra user fields during signup), you can use the userSignupFields
option:
This allows you to customize how user data is processed during the Google authentication flow Google Auth API Reference.
Remember that you'll need to create a Google OAuth app and configure it properly as described in the Wasp documentation for Google Auth.
----------------------
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
----------------------
Sorry @Gus, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist:
Perhaps try again in 15mins?Hey @Gus is the bot answering your questions or do you need some human assistance?
hey @Vinny (@Wasp) thanks for reaching out, the bot is fantastic, he's steering me in the right direction 😄
Ok cool. Let us know if you need any help aside from that :godfatherboi: