# Environment
URL: https://ark-ui.com/docs/utilities/environment
Source: https://raw.githubusercontent.com/chakra-ui/ark/refs/heads/main/website/src/content/pages/utilities/environment.mdx
Set up components for custom environments like iframes, Shadow DOM, or Electron.
---
## Motivation
We use [Zag.js](https://zagjs.com/overview/composition#custom-window-environment) internally, which relies on DOM query
methods like `document.querySelectorAll` and `document.getElementById`. In custom environments like iframes, Shadow DOM,
or Electron, these methods might not work as expected.
To handle this, Ark UI includes the `EnvironmentProvider`, allowing you to set the appropriate root node or document,
ensuring correct DOM queries.
## Setup
To support custom environments like an iframe, Shadow DOM or Electron, render the `EnvironmentProvider` component to
provide the environment context to all Ark UI components.
**Example: setup**
#### React
```tsx
import { EnvironmentProvider } from '@ark-ui/react/environment'
import Frame from 'react-frame-component'
export const App = () => {
return (
{JSON.stringify(getRootNode(), null, 2)}
}
```
#### Solid
```tsx
import { useEnvironmentContext } from '../use-environment-context'
export const Usage = () => {
const environment = useEnvironmentContext()
return {JSON.stringify(environment().getRootNode(), null, 2)}
}
```
#### Vue
```vue
{{ JSON.stringify(environment.getRootNode(), null, 2) }}
```
#### Svelte
```svelte
{JSON.stringify(environment().getRootNode(), null, 2)}
```
## API Reference
**Component API Reference**
#### React
**EnvironmentProvider Props:**
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `value` | `RootNode | (() => RootNode)` | No | |
#### Solid
**EnvironmentProvider Props:**
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `value` | `RootNode | (() => RootNode)` | No | |
#### Vue
**EnvironmentProvider Props:**
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `value` | `RootNode | (() => RootNode)` | No | |
#### Svelte
**EnvironmentProvider Props:**
| Prop | Type | Required | Description |
|------|------|----------|-------------|
| `value` | `MaybeFunction