---
title: "ReferenceMapStyle | Client js | Api client"
description: "Documentation for MapTiler Client"
---

> 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.

# Class ReferenceMapStyle

An instance of reference style contains a list of StyleVariants ordered by relevance

-   Defined in [mapstyle.ts:204](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L204)

##### Index

### Constructors

[constructor](#constructor)

### Methods

[addVariant](#addvariant) [getDefaultVariant](#getdefaultvariant) [getId](#getid) [getName](#getname) [getVariant](#getvariant) [getVariants](#getvariants) [hasVariant](#hasvariant)

## Constructors

### constructor[](#constructor)

-   new ReferenceMapStyle(name: string, id: string): ReferenceMapStyle[](#constructorreferencemapstyle)
    
    #### Parameters
    
    -   name: string
        
        Human-friendly name of this reference style
        
    -   id: string
        
        ID of this reference style
        
    
    #### Returns ReferenceMapStyle
    
    -   Defined in [mapstyle.ts:215](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L215)
    

## Methods

### addVariant[](#addvariant)

-   addVariant(v: [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)): void[](#addvariant-1)
    
    Add a variant to _this_ reference style
    
    #### Parameters
    
    -   v: [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)
    
    #### Returns void
    
    -   Defined in [mapstyle.ts:247](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L247)
    

### getDefaultVariant[](#getdefaultvariant)

-   getDefaultVariant(): [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)[](#getdefaultvariant-1)
    
    Get the defualt variant for this reference style
    
    #### Returns [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)
    
    -   Defined in [mapstyle.ts:283](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L283)
    

### getId[](#getid)

-   getId(): string[](#getid-1)
    
    Get the id of _this_ reference style
    
    #### Returns string
    
    -   Defined in [mapstyle.ts:239](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L239)
    

### getName[](#getname)

-   getName(): string[](#getname-1)
    
    Get the human-friendly name of this reference style
    
    #### Returns string
    
    -   Defined in [mapstyle.ts:231](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L231)
    

### getVariant[](#getvariant)

-   getVariant(variantType: string): [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)[](#getvariant-1)
    
    Get a given variant. If the given type of variant does not exist for this reference style, then the most relevant default variant is returned instead
    
    #### Parameters
    
    -   variantType: string
    
    #### Returns [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)
    
    -   Defined in [mapstyle.ts:267](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L267)
    

### getVariants[](#getvariants)

-   getVariants(): [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)\[\][](#getvariants-1)
    
    Get the list of variants for this reference style
    
    #### Returns [MapStyleVariant](https://docs.maptiler.com/client-js/api/classes/index.MapStyleVariant/)\[\]
    
    -   Defined in [mapstyle.ts:275](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L275)
    

### hasVariant[](#hasvariant)

-   hasVariant(variantType: string): boolean[](#hasvariant-1)
    
    Check if a given variant type exists for this reference style
    
    #### Parameters
    
    -   variantType: string
    
    #### Returns boolean
    
    -   Defined in [mapstyle.ts:257](https://github.com/maptiler/maptiler-client-js/blob/f88659ae276c959a754e4c0f3b5c2aae1f483caa/src/mapstyle.ts#L257)
