---
title: "MapboxWindowBuilding"
description: "Window-lit 3D buildings using a procedurally generated window grid as fill-extrusion-pattern."
canonical_url: "https://mapbox.mhaibaraai.cn/en/docs/effects/window-building"
---
# MapboxWindowBuilding

> Window-lit 3D buildings using a procedurally generated window grid as fill-extrusion-pattern.

## Introduction

`MapboxWindowBuilding` renders 3D buildings based on the official `composite/building` source, applying a procedurally generated window-grid texture as `fill-extrusion-pattern`; `rows` / `cols` / `litColor` / `darkColor` / `litRatio` / `seed` control the window appearance. Requires a tilted view and zoom ≥ `minzoom` (default 15).

## Usage

Light up random window panes in a night-style map:

```vue [WindowBuildingExample.vue]
<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap
      :options="{ style: 'mapbox://styles/mapbox/dark-v11', center: [116.461, 39.909], zoom: 15.5, pitch: 60, bearing: -20 }"
    >
      <MapboxWindowBuilding :rows="10" :cols="6" lit-color="#fde68a" dark-color="#1f2937" :lit-ratio="0.45" />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxWindowBuilding component
 */
interface MapboxWindowBuildingProps {
  /**
   * 图层 id；省略时自动生成
   */
  layerId?: string | undefined;
  /**
   * 窗户行数
   */
  rows?: number | undefined;
  /**
   * 窗户列数
   */
  cols?: number | undefined;
  /**
   * 亮窗颜色
   */
  litColor?: string | undefined;
  /**
   * 暗窗/墙体颜色
   */
  darkColor?: string | undefined;
  /**
   * 亮窗比例
   */
  litRatio?: number | undefined;
  /**
   * 随机种子
   */
  seed?: number | undefined;
  /**
   * 整体透明度
   */
  opacity?: number | undefined;
  /**
   * 最小缩放级别
   * @default "15"
   */
  minzoom?: number | undefined;
  /**
   * 插入到该图层之前
   */
  beforeId?: string | undefined;
}
```

## Changelog

See commit history for [src/runtime/components/effects/WindowBuilding.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/effects/WindowBuilding.vue).


## Sitemap

See the full [sitemap](https://mapbox.mhaibaraai.cn/sitemap.md) for all pages.
