# Customize the Theme

We offer a range of customization options to help you create a widget that matches your preferred style. Please refer to the guide below and our [Widget API reference](https://docs.xy.finance/bridge-aggregator-integration/xy-finance-widget-npm/widget-api-reference) for detailed instructions.

```tsx
const theme = {
  ...,
  mode: 'light'
}

function App() {
  return (
    <div>
      <Widget theme={theme} />
    </div>
  )
}
```

## mode

When customizing your website-style widget, start by selecting a mode that suits your preference and proceed with the following customization. We offer two modes: `dark` and `light`.

```tsx
const theme = {
  ...,
  mode: 'dark'
}
```

{% tabs %}
{% tab title="dark mode" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FE5tK9IJ95K8eKbW09PRZ%2FdarkModeSwapPage.png?alt=media&#x26;token=a1134d9f-25f8-48c3-bc54-69a6ebb61132" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="light mode" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FDRRUqJY1JaWmcbzgK8BX%2FlightModeSwapPage.png?alt=media&#x26;token=1888a0e2-2d07-4ced-a6ae-0a898a463642" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## font-family

This option sets the font display for the widget, and works in compatibility with [**css font-family property**](https://www.w3schools.com/cssref/pr_font_font-family.php).

```tsx
const theme = {
  ...,
  fontFamily: 'ui-sans-serif, system-ui, -apple-system'
}
```

{% hint style="info" %}
Please note that you need to install the font that you want to use in your frontend project by yourself.
{% endhint %}

## border-radius

You have the option to customize the border-radius of three different components based on your preference.

```tsx
const theme = {
  ...,
  borderRadius: {
    container: '12px',
    inner: '8px',
    button: '32px'
  }
}
```

Please refer to the image below to see the areas that are affected by each border-radius class:

{% tabs %}
{% tab title="container" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FnUe2M9yw2YPgT5xMJdlD%2FBorder%20Radius-Container.png?alt=media&#x26;token=655f06e7-acaa-4de1-b299-b1313b0b0449" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="inner" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FAltiAaenrL8tCADXDngP%2FBorder%20Radius-Inner.png?alt=media&#x26;token=73615d39-327c-4ecf-a752-7550eb701bd9" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="button" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FQQm8ycdG6TohsslaFu2l%2FBorder%20Radius-Button.png?alt=media&#x26;token=a1cfd851-2e8e-46e0-83aa-d72b119d482f" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

## colors

First and foremost, customize the colors that will be used in our widget to create a unified appearance. You have the option to select a primary color and a gradient color to personalize the components.

Secondary, the primary color represents the main color style of the entire widget. As shown in the example below, the primary color will be applied throughout the widget whenever it is used by users.

```tsx
const theme = {
  ...,
  colors: {
    primary: '#277EEC',
    gradient: ['#277EEC', '#1499E4']
  }
}
```

{% tabs %}
{% tab title="primary" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FMv91qkc8V5v3V10nxkcx%2FColor-Primary.png?alt=media&#x26;token=9fa983d8-4b0b-4df1-84fb-f706d8c9d94a" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="primary changed" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FbYQKop0JEMj5z1KRawwf%2FColor-Primary%20Changed.png?alt=media&#x26;token=32c5a6a0-1e4d-4d66-8e25-5ee94b913288" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Additionally, assign the chosen colors to the respective components. Currently, the button is the only component that supports gradient colors.

```tsx
const theme = {
  ...,
  colors: {
    primary: '#277EEC',
    gradient: ['#277EEC', '#1499E4']
  },
  components: {
    button: {
      variant: 'gradient' // 'filled' | 'gradient' | 'grey' | 'neutral'
    }
  }
}
```

If you prefer to have a single color for your button component, you can refer to the example code provided below to see the desired result.

```tsx
const theme = {
  ...,
  components: {
    button: {
      variant: 'filled' // The color will be determined by the primary color configuration as it is set to 'filled'.
    }
  }
}
```

{% tabs %}
{% tab title="gradient" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FaYN4h5PqN0kf3xGE01Ez%2Fgradient.png?alt=media&#x26;token=6761d455-d0ed-4659-b0dc-9e0259eafe64" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="filled" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FG0X23OAsDdgP2y3PWkfE%2Ffilled.png?alt=media&#x26;token=5c9a0145-6a22-46f1-8982-3de6a4fd1450" alt=""><figcaption></figcaption></figure>
{% endtab %}
{% endtabs %}

Last but not least, we also offer two additional styles for the button: 'grey' and 'neutral'. You can choose the style that best fits your preferences and design aesthetics.

{% tabs %}
{% tab title="grey" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FX6qcFwlGa129dogioBve%2Fgrey.png?alt=media&#x26;token=aa7e7785-bfb7-47ee-b99e-220e25ef6e41" alt=""><figcaption><p>grey</p></figcaption></figure>
{% endtab %}

{% tab title="neutral" %}

<figure><img src="https://3694085950-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mcs9EhDrgbKHodtcAT6%2Fuploads%2FcC4BvdonTLdYwm1trDz0%2Fneutral.png?alt=media&#x26;token=cdeea0ed-5b4c-40ae-b3e0-e7c6845a37c9" alt=""><figcaption><p>neutral</p></figcaption></figure>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
For additional information, please refer to our [Widget API Reference](https://docs.xy.finance/bridge-aggregator-integration/xy-finance-widget-npm/widget-api-reference).
{% endhint %}
