gridland
Guides

Vite

Use Gridland with Vite

Install

Terminal
bun add @gridland/web
Terminal
npm install @gridland/web
Terminal
yarn add @gridland/web
Terminal
pnpm add @gridland/web

Configure the Vite Plugin

Gridland provides a Vite plugin that handles module resolution for the underlying opentui engine. Add it to your vite.config.ts:

vite.config.ts
import { defineConfig } from "vite"
import react from "@vitejs/plugin-react"
import { gridlandWebPlugin } from "@gridland/web/vite-plugin"

export default defineConfig({
  plugins: [
    react(),
    ...gridlandWebPlugin(),
  ],
})

Create Your Component

Wrap your TUI content in TUI:

App.tsx
import { TUI } from "@gridland/web"

function GridlandDemo() {
  return (
    <box flexDirection="column" padding={1}>
      <box border borderStyle="rounded" borderColor="#88c0d0" padding={1}>
        <text fg="#a3be8c">Hello from Vite!</text>
      </box>
    </box>
  )
}

export default function App() {
  return (
    <TUI style={{ width: "100vw", height: "100vh" }}>
      <GridlandDemo />
    </TUI>
  )
}