> For the complete documentation index, see [llms.txt](https://docs.zofinance.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.zofinance.io/building-on-zo/trading-widget/quick-start.md).

# Quick Start

### Full Widget Layout

1. **Wrap your app** with the required providers (order matters):

```tsx
import { appStore } from '@zofai/trading-widget'
import { Provider as JotaiProvider } from 'jotai'
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { DAppKitProvider } from '@mysten/dapp-kit-react'

// Your dapp-kit instance (Sui wallet + network)
import { dAppKit } from './dapp-kit'

const queryClient = new QueryClient({
  defaultOptions: {
    queries: { staleTime: 60_000, retry: 2 },
  },
})

export function Root() {
  return (
    <JotaiProvider store={appStore}>
      <QueryClientProvider client={queryClient}>
        <DAppKitProvider dAppKit={dAppKit}>
          <App />
        </DAppKitProvider>
      </QueryClientProvider>
    </JotaiProvider>
  )
}
```

2. **Render the widget** where you want the trading UI:

```tsx
import { TradingWidget } from '@zo/trading-widget'

export function App() {
  return (
    <div className="h-screen flex flex-col">
      <header>{/* Your navbar, connect button, etc. */}</header>
      <main className="min-h-0 flex-1">
        <TradingWidget className="h-full" />
      </main>
    </div>
  )
}
```

**TradingWidget props**

| Prop        | Type     | Description                         |
| ----------- | -------- | ----------------------------------- |
| `symbol`    | `string` | Initial symbol (default `"BTC"`)    |
| `className` | `string` | Extra class on the widget container |

The default `<TradingWidget />` contains:

* Header – MarketHeader
* Symbol dropdown (index tokens from ZLP / SLP)
* Mark price
* 1h funding rate
* Main area
* PriceChart (Pyth candlesticks + streaming)
* RecentTrades (live trades)
* TradePanel (open positions, leverage, collaterals)
* Bottom tabs – BottomTabs
* PositionsList
* OrdersList
* HistoryList
* Each tab shows a circular countdown to the next auto-refresh.
* Dialogs & toasts
* Confirmation and success dialogs (open / close / adjust)
* Toast notifications via react-hot-toast.

Use this when you want the fastest integration path.


---

# 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.zofinance.io/building-on-zo/trading-widget/quick-start.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.
