Skip to main content

Changing Style via CSS

Updating the CSS allows you to change the UI of our components to meet your needs.

This section will guide you through an example of updating the look of headings. Note that the process can be applied to update any HTML tags from within SuperTokens components.

Global style changes#

How to make changes#

First, let's open our website at /auth. The Sign-in widget should show up. Let's use the browser console to find out the class name that we'd like to overwrite.

Each stylable components contains data-supertokens attributes (in our example data-supertokens="headerTitle").

Let's add a headerTitle attribute to our configuration file. The syntax for styling is the same as React inline styling

SuperTokens.init({    appInfo: {...},    recipeList: [        ThirdParty.init({            palette: {...},            style: {                headerTitle: {                    border: '3px',                    borderColor: "#000000",                    borderStyle: "solid"                }            }        }),        Session.init()    ]});

The above will result in:

Changing fonts#

By default, SuperTokens loads and uses the 'Rubik' font. The best way to override this is to add styling to the container component in the recipe configuration. Doing so will prevent the SDK from loading the default font.

SuperTokens.init({    appInfo: {...},    recipeList: [        ThirdParty.init({            palette: {...},            style: {                container: {                    fontFamily: "cursive"                }            }        }),        Session.init()    ]});

Using media queries#

You may want to have different CSS for different viewports. This can be achieved via media queries like this:

style: {    headerTitle: {        border: '3px',        borderColor: "#000000",        borderStyle: "solid"        "@media (max-width: 440px)": {            border: "5px",        },    }}

Customising the Sign-Up / Sign-In form#

These are the screens shown when the user tries to log in or sign up for the application.

SuperTokens.init({    recipeList: [        ThirdParty.init({            signInAndUpFeature: {                style: {...}            }        }),        Session.init()    ]});

Customizing the OAuth callback screen#

This screen is shown when the user returns to the application from the OAuth provider

SuperTokens.init({    recipeList: [        ThirdParty.init({            oAuthCallbackScreen: {                style: {...}            }        }),         Session.init()    ]});

Customise the Email Verification forms#

Send verification email screen#

This screen is shown when the user logs in and is redirected to a screen which asks them to send an email verification email.

SuperTokens.init({    recipeList: [        ThirdParty.init({            emailVerificationFeature: {                sendVerifyEmailScreen: {                    style: {...}                }            }        }),        Session.init()    ]});

Verify email link clicked screen#

This screen is shown when the user clicks the email verification link on their email.

SuperTokens.init({    recipeList: [        ThirdParty.init({            emailVerificationFeature: {                verifyEmailLinkClickedScreen: {                    style: {...}                }            }        }),        Session.init()    ]});