> For the complete documentation index, see [llms.txt](https://docs.sentre.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sentre.io/development/providers/ui-provider.md).

# UI Provider

UIProvider is strictly required if the DApp uses default UI system of the platform, or a customized design system based on Ant Design.

## API

```tsx
<UIProvider> ... </UIProvider>
```

| Property | Type                                    | Description                                                                                                                                    | Default   |
| -------- | --------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- | --------- |
| children | ReactNode                               | The wrapped children.                                                                                                                          | undefined |
| appId    | string                                  | DApp's id.                                                                                                                                     |           |
| style    | ?CSSPreperties                          | The additional style for `span` tags.                                                                                                          | {}        |
| antd     | ? (boolean \| FC\<ConfigProviderProps>) | Enable isolated antd. You can input the ConfigProvider as [Ant Design ConfigProvider API](https://ant.design/components/config-provider/#API). | false     |

#### For example

```tsx
import { UIProvider } from '@sentre/senhub'

// Wrap a paragraph as a child and style it to red color.
<UIProvider appId="my_app" style={{color: 'red'}}>
  <p>Hello world</p>
</UIProvider>
```

## Context

```typescript
type Provider = {
  ui: State
}

type State = {
  theme: 'light' | 'dark'
  width: number
  infix: 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'
  touchable: boolean
  visibleActionCenter: boolean
}
```

#### Provider

| Property | Type  | Description              |
| -------- | ----- | ------------------------ |
| ui       | State | The user interface data. |

#### State

| Property            | Type                              | Description                           |
| ------------------- | --------------------------------- | ------------------------------------- |
| theme               | light \| dark                     | Current theme mode.                   |
| width               | number                            | Current width of screen.              |
| infix               | xs \| sm \| md \| lg \| xl \| xxl | Current breakpoint of screen.         |
| touchable           | boolean                           | Whether or not touch screen.          |
| visibleActionCenter | boolean                           | Whether or not visible action center. |

## Hook & HOC

```typescript
import { useUI, withUI } from '@senhub/providers'
```

#### For example

{% hint style="info" %}
Wrap the parent by UIProvider before accessing the context.
{% endhint %}

```tsx
import { useUI, withUI } from '@senhub/providers'

// Within a functional component
const Component = () => {
  const {
    ui: { width, infix },
  } = useUI()
}
export default Component

// Within a class component
class Component {
  render() {
    const {
      ui: { width, infix },
    } = this.props
  }
}
export default withUI(Component)
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sentre.io/development/providers/ui-provider.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
