---
url: /api/formats/scope/src/functions/createScope.md
---
[pantoken-root](../../../../index.md) / [formats/scope/src](../index.md) / createScope

# Function: createScope()

> **createScope**(`element`, `options?`): [`PantokenScope`](../interfaces/PantokenScope.md)

Beta

Create a scope rooted at `element`.

## Parameters

### element

`HTMLElement`

### options?

[`CreateScopeOptions`](../interfaces/CreateScopeOptions.md) = `{}`

## Returns

[`PantokenScope`](../interfaces/PantokenScope.md)

## Example

**Two independent themes on one page**

```ts
import { createScope } from "@pantoken/scope";

createScope(document.querySelector("#app")!, { theme: "rebrand", scheme: "dark" });
createScope(document.querySelector("#preview")!, {
  instanceId: "preview",
  theme: "canvas",
  scheme: "light",
  boundary: true,
});
```
