---
title: ThemeProvider
---

import LibraryInfo from '@theme/LibraryInfo'
import { PropsTable } from '../../src/components'
import { ThemeProvider } from '@telus-uds/components-base'
import { ThemeProvider as BaseDocs } from 'docs/@telus-uds/components-base'

# ThemeProvider

<LibraryInfo />

```jsx
<ThemeProvider>{/* themed UDS Base components*/}</ThemeProvider>
```

## Introduction

```jsx
import { ThemeProvider } from '@telus-uds/components-base'
```

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

:::info
ThemeProvider is automatically included in BaseProvider. **You don't need to include ThemeProvider separately in your app if you are already using BaseProvider**.
:::

ThemeProvider makes a UDS theme available in React context for UDS Base components to consume.

### Theme switching

:::info
coming soon!
:::

### Spacing scale

ThemeProvider exposes the (12 stop) spacing scale corresponding to the UDS theme passed via the `useSizingScale` hook

```jsx live
function SizingScale() {
  const Scale = ({ index }) => {
    const value = useSpacingScale(index)
    return (
      <div>
        {index} / {value}px
      </div>
    )
  }

  return (
    <div>
      {Array.apply(null, Array(12)).map((_, i) => (
        <Scale index={i} key={i} />
      ))}
    </div>
  )
}
```

## Props

<PropsTable base={BaseDocs} />
