---
title: "React, Vue or Angular: customize the widget"
description: "Callbacks, behavior and styles of the Block-Auth login button."
url: "/sdk-integration-spa-customize/"
language: "en"
guide: "React, Vue, Angular (+ backend)"
step: "More options, optional"
---

# Customize the widget

Optional. Callbacks, behavior and styles of the login button.

## Customize the widget

Your `apiKey`, and `authEndpoint` if you change it, go in `config` ([Configure the widget](/sdk-integration-spa-frontend.md#configure-widget)). The components only take behavior, callback and styling props.

Props are documented with their React names; the same surface exists in every binding with the framework's idiom:

- **Vue:** same props in kebab-case (`:on-success`, `:dropdown-btn-size`, `:show-dropdown-when-connected`, …).
- **Angular:** styling and behavior props are inputs (`[dropdownBtnSize]`, `[showDropdownWhenConnected]`, …) and callbacks are outputs: `(success)`, `(errored)` and `(loggedOut)` in `FlowBlockAuth`, `(linked)` and `(errored)` in `LinkBlockAuth`.

### `FlowBlockAuth`: callbacks

- `onSuccess` _(function)_: called after a successful login, with the user's `address`.
- `onError` _(function)_: called when the login fails or the user closes the login window.
- `onLogout` _(function)_: called after the user logs out from the profile menu.

### `FlowBlockAuth`: behavior

- `showDropdownWhenConnected` _(boolean)_: shows the profile menu when the user is signed in (default: `true`).
- `isInsideModal` _(boolean)_: set it to `true` when the button is inside your own modal (default: `false`).
- `containerRef` _(ref)_: the modal's container, used with `isInsideModal` to detect clicks outside.
- `buttonText` _(string)_: label of the sign-in button.

### `FlowBlockAuth`: when your backend handles the login

With the [backend routes](/sdk-integration-spa-backend.md#backend-routes) you don't need these props. Use them only if your page already knows the user or your backend redeems the code its own way. In Angular both are inputs: `[user]` and `[onAuthCode]`.

- `user` _(object | null)_: the signed-in user as your backend knows it (`{ address, did, roles }`), or `null` if nobody is signed in. With it, the widget shows that user and doesn't ask `/me` when the page loads, for example when your server already renders the user.
- `onAuthCode` _(function)_: receives `{ code, codeVerifier, redirectUri }` after the login instead of sending it to `/code`. Send it to your backend, redeem it there and return the user. Unless you also set `authEndpoint`, the widget then doesn't call `/me` or `/logout` nor check the session: close your session in `onLogout`.

### `FlowBlockAuth`: styling

- `btnClassNames`
- `btnTextClassNames`
- `dropdownBtnSize` _(string)_: `"xs"`, `"small"`, `"base"` or `"large"` (default: `"small"`).
- `dropdownBtnBgClassNames`
- `dropdownBtnTextColorClassNames`
- `dropdownBtnBorderClassNames`
- `dropdownHeight` _(number)_
- `additionalDropdownItems` _(array)_: extra options for the profile menu. Each item is `{ onClick, text, firstIcon?, disabled? }`, where `text` is a string or a map per language (`{ es, en }`).

### `LinkBlockAuth`

The [account linking](/sdk-integration-spa-extras.md#link-users) button. It hides itself once the user is linked.

- `onLinked` _(function)_: called after the account is linked.
- `onError` _(function)_: called with the reason: `already_linked`, `not_signed_in` or `failed`.
- `buttonText` _(string)_: label of the button.
- `btnClassNames`, `btnTextClassNames`: same as in `FlowBlockAuth`.
