---
title: "CubemapDefinition | JavaScript maps SDK"
description: "Documentation for MapTiler SDK"
---

> For AI agents: a documentation index is available at [/llms.txt](https://docs.maptiler.com/llms.txt). Markdown versions of all pages are available by appending .md to any URL.

# Type Alias CubemapDefinition

CubemapDefinition:  
    | {  
        color?: string;  
        faces?: never;  
        path: { baseUrl: string; format?: "png"  
        | "jpg"  
        | "webp" };  
        preset?: never;  
    }  
    | { color?: string; faces: [CubemapFaces](https://docs.maptiler.com/sdk-js/api-reference/types/CubemapFaces/); path?: never; preset?: never }  
    | {  
        color?: string;  
        faces?: never;  
        path?: never;  
        preset: keyof typeof [cubemapPresets](https://docs.maptiler.com/sdk-js/api-reference/variables/cubemapPresets/);  
    }  
    | { color: string; faces?: never; path?: never; preset?: never }

Defines how a cubemap should be constructed from source materials. This is a discriminated union type with four possible formats:

1.  Path-based: Specify a base URL and optional format for cube face images
2.  Faces-based: Provide explicit URLs for each cube face
3.  Preset-based: Use a predefined cubemap from available presets
4.  Color-based: Use a single color for all faces

Only one of `path`, `faces`, `preset`, or `color` should be provided.

#### Example[](#example)

```typescript
// Path-based cubemap
const pathCubemap: CubemapDefinition = {
  path: {
    baseUrl: 'https://example.com/cubemap',
    format: 'png'
  }
};

// Color-based cubemap
const colorCubemap: CubemapDefinition = {
  color: '#ff0000'
};
```
