# injectSiMapStyle Type documentation

## TypeScript declaration

### [injectSiMapStyle](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-maplibre-style.ts#L25-L32>)

**Kind:** constant

```
import { injectSiMapStyle } from '@siemens/element-ng/maplibre';
```

Creates a signal that returns a [StyleSpecification](<https://maplibre.org/maplibre-style-spec/>) for MapLibre GL based on the current Element theme. The signal automatically updates when the theme switches between light and dark.

@remarks: **Must be called in an Angular injection context** (e.g. inside a constructor, field initializer, or a function called from one). Calling this function outside of an injection context will throw an `assertInInjectionContext` error.

Returns: A signal that provides the current [StyleSpecification](<https://maplibre.org/maplibre-style-spec/>) based on the active theme

Throws: When called outside of an Angular injection context

```
(key: string) => Signal<StyleSpecification> = ...
```

```
injectSiMapStyle(key: string): Signal<StyleSpecification>
```

Creates a signal that returns a [StyleSpecification](<https://maplibre.org/maplibre-style-spec/>) for MapLibre GL based on the current Element theme. The signal automatically updates when the theme switches between light and dark.

@remarks: **Must be called in an Angular injection context** (e.g. inside a constructor, field initializer, or a function called from one). Calling this function outside of an injection context will throw an `assertInInjectionContext` error.

Returns: A signal that provides the current [StyleSpecification](<https://maplibre.org/maplibre-style-spec/>) based on the active theme

Throws: When called outside of an Angular injection context

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [key](<https://github.com/siemens/element/blob/main/projects/element-ng/maplibre/si-maplibre-style.ts#L25-L25>) | `string` |  | • The MapTiler API key used to fetch tiles, glyphs, and sprites |

**Returns:** [Signal](<https://angular.dev/api/core/Signal>)`<`[StyleSpecification](<https://maplibre.org/maplibre-style-spec/>)`>`
