> ## Documentation Index
> Fetch the complete documentation index at: https://stytch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Upgrade Guide

> How to upgrade between major versions of the SDK

# From 5 to 6> [!NOTE]
>
> @stytch/vanilla-js is no longer needed for [@stytch/react](https://stytch.com/docs/api-reference/b2b/frontend-sdks/react/upgrade-guide.md#from-19-to-20)
> and [@stytch/nextjs](https://stytch.com/docs/api-reference/b2b/frontend-sdks/nextjs/upgrade-guide.md#from-21-to-22).
> See their respective upgrade guides for how how to update to the new version.## Compatibility<ul><li>Browser support: We support Safari mobile and desktop 16, Chrome 109 and Firefox 106.
Browsers older than this may still be able to use our SDK, but may require additional transpile and polyfills.</li>
<li>No polyfills are included since all APIs used are also supported in the versions supported.</li>
<li>Custom themes require support for [`color-mix` CSS function](https://caniuse.com/wf-color-mix).
A compatibility helper is available if you are targeting older browsers.</li></ul>## Step by step guide**1. Upgrade @stytch/vanilla-js**Run `npm`, `yarn` or `pnpm` to install the new version.```json package.json theme={null}
"@stytch/vanilla-js": "^5.0.0", // [!code --]
"@stytch/vanilla-js": "^6.0.0", // [!code ++]
\```**2. Update to use custom element**The library now exports a custom element, and StytchB2BUIClient is deprecated in favor of StytchB2BClient.
Instead of calling `stytch.mount()`, register the custom element and call `render()` on the element to pass in the client and config.```js theme={null}
import {
  StytchB2BUIClient, // [!code --]
  StytchB2B, // [!code ++:2]
  createStytchB2BClient,
} from '@stytch/vanilla-js/b2b';

const stytch = new StytchB2BUIClient($YOUR_PUBLIC_KEY); // [!code --]
const stytch = createStytchB2BClient($YOUR_PUBLIC_KEY); // [!code ++]

stytch.mount({ // [!code --:4]
  elementId: "#stytch-b2b-ui",
  config,
});
customElements.define('stytch-b2b-ui', StytchB2B); // [!code ++:5]
document.getElementById('stytch-b2b-ui').render({
  client: stytch,
  config,
})
\```

\\**3. Update products configuration**

If `config.products` are specified as strings, update them to use `B2BProducts` instead:



      

import \\\\\\\\{ B2BProducts \\\\\\\\} from '@stytch/vanilla-js/b2b'; // [!code ++]

const config = \\\\\\\\{
  products: ['oauth', 'eml'], // [!code --]
  products: [B2BProducts.oauth, B2BProducts.emailMagicLinks], // [!code ++]
\\\\\\\\};



\\**4. Update styles to presentation**

![](https://mintcdn.com/stytch-34ca0595/93M76QAF-n7zps9g/images/api-reference/b2b/frontend-sdks/prebuilt-ui-login.png?fit=max\\\\&auto=format\\\\&n=93M76QAF-n7zps9g\\\\&q=85\\\\&s=fe694852aa671c0de17daf942b27b29c)


The new `presentation` property now controls theming and styling options.
This differs from the previous `style` property in that it configures tokens affecting many elements rather than properties on specific elements.





We have provided a migration helper function. In development mode this function
will also print out warnings about properties that could not be migrated.





import \\\\\\\\{ styleToTheme \\\\\\\\} from '@stytch/vanilla-js/compat'; // [!code ++]

const config = \\\\\\\\{
  style: \\\\\\\\{ ... \\\\\\\\}, // [!code --]
  // This will also print out the recommended migrated config // [!code ++:3]
  // which should replace this in production
  theme: styleToTheme(\\\\\\\\{ ... \\\\\\\\}),
\\\\\\\\};



For a full list of supported properties, see reference documentation for [`presentation`](./prebuilt-ui/theming#reference).



\\\\### `presentation.theme`





Controls CSS styling. 
Each token corresponds to some CSS properties, so each value should be a CSS value.
You can also provide an array of `[lightTheme, darkTheme]` which will automatically switch 
between the two depending on the user's OS color scheme.





\\\\**theme migration**

\\\\<table><thead><tr><th>style</th>
        \\\\<th>presentation.theme</th></tr></thead>
    \\\\<tbody><tr><td>container.backgroundColor</td>
        \\\\<td>background</td></tr>
      \\\\<tr><td>container.borderColor</td>
        \\\\<td>border / container-border</td></tr>
      \\\\<tr><td>container.borderRadius</td>
        \\\\<td>rounded-base / container-radius</td></tr>
      \\\\<tr><td>container.width</td>
        \\\\<td>container-width</td></tr>
      \\\\<tr><td>colors.primary</td>
        \\\\<td>primary</td></tr>
      \\\\<tr><td>colors.secondary</td>
        \\\\<td>secondary</td></tr>
      \\\\<tr><td>colors.accent</td>
        \\\\<td>accent</td></tr>
      \\\\<tr><td>colors.success</td>
        \\\\<td>success</td></tr>
      \\\\<tr><td>colors.warning</td>
        \\\\<td>warning</td></tr>
      \\\\<tr><td>colors.error</td>
        \\\\<td>destructive</td></tr>
      \\\\<tr><td>buttons.primary.backgroundColor</td>
        \\\\<td>primary</td></tr>
      \\\\<tr><td>buttons.primary.textColor</td>
        \\\\<td>primary-foreground</td></tr>
      \\\\<tr><td>buttons.primary.borderRadius</td>
        \\\\<td>rounded-base / button-radius</td></tr>
      \\\\<tr><td>buttons.secondary.backgroundColor</td>
        \\\\<td>secondary</td></tr>
      \\\\<tr><td>buttons.secondary.textColor</td>
        \\\\<td>secondary-foreground</td></tr>
      \\\\<tr><td>buttons.secondary.borderRadius</td>
        \\\\<td>rounded-base / button-radius</td></tr>
      \\\\<tr><td>inputs.borderColor</td>
        \\\\<td>input</td></tr>
      \\\\<tr><td>inputs.placeholderColor</td>
        \\\\<td>muted-foreground</td></tr>
      \\\\<tr><td>inputs.borderRadius</td>
        \\\\<td>rounded-base / input-radius</td></tr>
      \\\\<tr><td>fontFamily</td>
        \\\\<td>font-family</td></tr></tbody></table>

  

New properties:



  \\\\<ul><li>**color-scheme**: Declares the theme as either light or dark.</li>
    \\\\<li>**font-family-mono**: Font for TOTP and recovery code</li>
    \\\\<li>**header-font**: Font for headers</li>
    \\\\<li>**spacing**, **rounded-base**, **text-base**: Base units for size and spacing between items, border radius and font size</li>
    \\\\<li>**mobile-breakpoint**: Screen width at which input and buttons are rendered larger for touchscreen users</li>
    \\\\<li>**shadow**, **shadow-button**, **shadow-input**: Optional box-shadow applied to buttons and inputs</li>
    \\\\<li>**transition-duration**: Transition duration. Set to 0 to disable transitions</li></ul>





\\\\### `presentation.options`



Controls non-styling options such as the logo to display.



\\\\**options migration**

\\\\<table><thead><tr><th>style</th>
        \\\\<th>presentation.options</th></tr></thead>
    \\\\<tbody><tr><td>hideHeaderText</td>
        \\\\<td>hideHeaderText</td></tr>
      \\\\<tr><td>logo.logoImageUrl</td>
        \\\\<td>logo.url</td></tr></tbody></table>

  

New properties:



  \\\\<ul><li>**logo.alt**: Alt text for the logo</li></ul>





\\\\### More styling changes





These changes are unlikely to cause issues.





\\\\**more style changes**

\\\\### Component size




Stytch UI component now use `max-width` rather than `width` to make it more flexible. This means the component may render at a size smaller than expected if it is placed in a flexbox or grid. To restore previous behavior, wrap it in a `div` with your desired width.





\\\\\\\\<div style="width: 400px"\\\\\\\\>
  \\\\\\\\<stytch-ui /\\\\\\\\>
\\\\\\\\</div\\\\\\\\>





\\\\### Style isolation and injection





The SDK now injects styles into the `head` element as a `style` tag. The component styling is also slightly less aggressive, so global styles may affect internal styling differently. If you would like complete style isolation, we recommend enabling shadow DOM.





\\\\\\\\<stytch-ui shadow="true" /\\\\\\\\>





\\\\### Element IDs





Some element IDs have been removed. To restore them, use `presentation.options.buttonId`. We do not recommend using the IDs to modify Stytch UI component styles or DOM.





const presentation = \\\\\\\\{
  options: \\\\\\\\{
    buttonId: true, // Or set to a string to add a suffix to make ID unique
  \\\\\\\\},
\\\\\\\\};



\\**5. Update customized strings**

If you use [string customization](https://stytch.com/docs/api-reference/b2b/frontend-sdks/vanilla-js/prebuilt-ui/login/text-customization),
check if you need to update these strings:



      

\\\\**updated strings**

\\\\<table><thead><tr><th>Old ID</th>
              \\\\<th>Old Text</th>
              \\\\<th>New ID</th>
              \\\\<th>New Text</th>
              \\\\<th>Notes</th></tr></thead>
          \\\\<tbody><tr><td>button.back.ariaLabel</td>
              \\\\<td>Back</td>
              \\\\<td>button.goBack</td>
              \\\\<td>Go back</td>
              \\\\<td>[**1**](#footnote-1)</td></tr>
            \\\\<tr><td>button.forgotPassword</td>
              \\\\<td>Forgot Password?</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Forgot your password?</td>
              \\\\<td /></tr>
            \\\\<tr><td>password.forgot.title</td>
              \\\\<td>Forgot password?</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Forgot your password?</td>
              \\\\<td /></tr>
            \\\\<tr><td>button.hidePassword</td>
              \\\\<td>Hide password</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Hide</td>
              \\\\<td>[**1**](#footnote-1)</td></tr>
            \\\\<tr><td>button.showPassword</td>
              \\\\<td>Show password</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Show</td>
              \\\\<td>[**1**](#footnote-1)</td></tr>
            \\\\<tr><td>button.loginWithoutPassword</td>
              \\\\<td>Login without a password</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Log in without a password</td>
              \\\\<td /></tr>
            \\\\<tr><td>crypto.error.content</td>
              \\\\<td>Your sign in request could not be completed. Use the back arrow
to return to the log in screen and try again!</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Your sign in request could not be completed. Go back to the main
screen and try logging in again.</td>
              \\\\<td /></tr>
            \\\\<tr><td>crypto.setupNewWallet.content</td>
              \\\\<td>Signing in with a crypto wallet can help keep your account
private and secure.</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Get started by downloading any Ethereum or Solana wallet.</td>
              \\\\<td /></tr>
            \\\\<tr><td>crypto.setupNewWallet.instruction</td>
              \\\\<td>Get started by downloading any Ethereum or Solana wallet. We've
included a few examples of wallet extensions you can find below.
Once you've set up your wallet, you can use it to sign in!</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>We've included a few examples of wallet extensions you can find
below. Once you've set up your wallet, click "Go back" to use it
and sign in.</td>
              \\\\<td /></tr>
            \\\\<tr><td>crypto.troubleHelp</td>
              \\\\<td>Having trouble? Use the back arrow to return to the main screen
and try logging in again.</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>If you are having trouble, go back to the main screen and try
logging in again.</td>
              \\\\<td /></tr>
            \\\\<tr><td>oauth.continueWithTwitter</td>
              \\\\<td>Continue with Twitter</td>
              \\\\<td>oauth.continueWithX</td>
              \\\\<td>Continue with X</td>
              \\\\<td /></tr>
            \\\\<tr><td>passcode.codeSent / passcode.didntGetIt</td>
              \\\\<td>Code sent / Didn't get it?</td>
              \\\\<td>passcode.codeSent</td>
              \\\\<td>Code sent! Try again in \\\\\\\\{timeRemaining\\\\\\\\}s</td>
              \\\\<td /></tr>
            \\\\<tr><td>toast.emailResent</td>
              \\\\<td>Email resent</td>
              \\\\<td>button.emailResent</td>
              \\\\<td>Email resent! Try again in \\\\\\\\{timeRemaining\\\\\\\\}s</td>
              \\\\<td /></tr>
            \\\\<tr><td>password.didntGetItResend</td>
              \\\\<td>Didn't get it? <resendButton>Resend
email</resendButton></td>
              \\\\<td>button.resendEmail</td>
              \\\\<td>Resend email</td>
              \\\\<td /></tr>
            \\\\<tr><td>watermark.altText</td>
              \\\\<td>Powered by Stytch</td>
              \\\\<td>(Unchanged)</td>
              \\\\<td>Stytch by Twilio</td>
              \\\\<td /></tr></tbody></table>

        

\\\\<sup>1</sup> This was previously only for non-visual users, now it is
displayed as text.



      

You may also wish to customize these new strings:



      

\\\\**new strings**

\\\\<table><thead><tr><th>ID</th>
              \\\\<th>Text</th>
              \\\\<th>Notes</th></tr></thead>
          \\\\<tbody><tr><td>loading.label</td>
              \\\\<td>Loading</td>
              \\\\<td /></tr>
            \\\\<tr><td>emailConfirmation.emailSent</td>
              \\\\<td>Email sent! Try again in \\\\\\\\{timeRemaining\\\\\\\\}s</td></tr>
            \\\\<tr><td>password.requirement.fulfilled</td>
              \\\\<td>Fulfilled</td>
              \\\\<td>[**2**](#footnote-2)</td></tr>
            \\\\<tr><td>password.requirement.notFulfilled</td>
              \\\\<td>Not fulfilled</td>
              \\\\<td>[**2**](#footnote-2)</td></tr>
            \\\\<tr><td>password.requirement.suggestion</td>
              \\\\<td>Suggestion</td>
              \\\\<td>[**2**](#footnote-2)</td></tr>
            \\\\<tr><td>password.requirement.warning</td>
              \\\\<td>Warning</td>
              \\\\<td>[**2**](#footnote-2)</td></tr>
            \\\\<tr><td>tab.listLabel</td>
              \\\\<td>Select login method</td>
              \\\\<td>[**2**](#footnote-2)</td></tr>
            \\\\<tr><td>watermark.poweredBy</td>
              \\\\<td>Powered by</td>
              \\\\<td /></tr></tbody></table>

        

\\\\<sup>2</sup> This is an accessibility label for non-visual users.

\**6. Update deprecated imports**The following are deprecated and should be updated.- `createStytchB2BUIClient` → `createStytchB2BClient`
\- `createStytchB2BHeadlessClient` → `createStytchB2BClient`
\- `StytchB2BUIClient`  → `StytchB2BClient`
\- `StytchB2BHeadlessClient`  → `StytchB2BClient`**7. Test your changes**We recommend running through every auth method used to make sure the new theme looks correct in context. You should also take note of errors or warnings in the browser console.
