# ShapeStyle

How polygons or lines are drawn: a fill (or a stroke, for lines) coloured
by a rule, with outline width, hatching, dashing and labels. Its default
label type remains a plain string; feed definitions that use keyed labels
use [`FeedShapeStyle`](https://docs.mapcairn.com/api/core/FeedShapeStyle.md). The legend is derived from it.

This is an interface exported by `@mapcairn/core`, checked against version 0.2.0.

## Signature

```ts
import type { ShapeStyle } from "@mapcairn/core";
 
interface ShapeStyle<T extends LayerTemplate = string>
```

## Type parameters

- `T?` (`LayerTemplate`)

## Properties

### colour

```ts
readonly colour: ShapeColour;
```

The rule that picks each shape's colour.

### dash

```ts
readonly dash?: LineDash;
```

Dashing of the outline or line. Defaults to `solid`. A class's own `dash` wins.

### fillOpacity

```ts
readonly fillOpacity?: number;
```

Fill opacity of polygons, 0.1 to 1. Defaults to 0.55.

### geometry

```ts
readonly geometry: "area" | "line";
```

Whether the style draws polygons (`area`) or lines (`line`).

### kind

```ts
readonly kind: "shapes";
```

Always `shapes`; tells a shape style from a point style.

### label

```ts
readonly label?: ShapeLabel<T>;
```

A template for the text drawn on each shape, over the decoded fields or tile properties.

### width

```ts
readonly width?: number;
```

Stroke width in pixels, 0.5 to 12: a polygon's outline (default 1.5) or a
line (default 2.5). A class's own `width` wins.

## Remarks

A style draws one geometry kind, so its legend and widths are
 unambiguous: `area` draws polygons and multipolygons, `line` draws lines
 and multilines. Features of the other kind are not drawn. A polygon's
 outline is the palette's ink, so the shape reads on any fill.

## See also

- [`LayerTemplate`](https://docs.mapcairn.com/api/core/LayerTemplate.md)
- [`ShapeColour`](https://docs.mapcairn.com/api/core/ShapeColour.md)
- [`LineDash`](https://docs.mapcairn.com/api/core/LineDash.md)
- [`ShapeLabel`](https://docs.mapcairn.com/api/core/ShapeLabel-interface.md)

Source: [packages/core/src/layers/definition.ts:500](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/layers/definition.ts#L500)
