# createLinePath

```ts
import { createLinePath, Path } from "@pibbl/core";
```

[`LinePathOptions`](/reference/types/elements-components/#linepathoptions) is accepted by `createLinePath(options): Path2D`, which creates a fresh path from
finite numeric coordinate pairs and optional `closePath`. It is pure, and does
not attach paint, events, or caching.

```tsx
<Path
  style={{
    d: createLinePath({
      coords: [
        [0, 0],
        [80, 40],
        [160, 0],
      ],
    }),
    stroke: "#2563eb",
  }}
/>
```

Try the [Line live example](/playground/#/examples/drawing/line).

## API details from source

<span id="api-createLinePath"></span>

Creates a Canvas Path2D for line geometry from validated options.

```ts
createLinePath: (options: Readonly<LinePathOptions>) => Path2D
```

Related API: [createLinePath](/reference/functions/create-line-path/), [LinePathOptions](/reference/types/elements-components/#linepathoptions).

### Parameters

- **`options`** — Ordered vertices and whether to close the path. See [LinePathOptions](/reference/types/elements-components/#linepathoptions).

### Returns

A native Canvas path containing the line.

### See also

[LinePathOptions](/reference/types/elements-components/#linepathoptions)

[View source — packages/core/src/lib/geometry/line.ts:23](/source/packages/core/src/lib/geometry/line-ts/#L23)

## Implementation guidance for agents

Read the [Drawing, layout, and effects companion](/agents/topics/layout/) for ownership, adaptation, failure modes, and verification. [Agent start](/agents/) provides the version-selection workflow.

## Complete minimal examples

- [Line and SVG paths](/minimal-examples/paths/line-svg-factories/): Construct a polyline and an SVG path from authored coordinates. [Plain source](/minimal/paths/line-svg-factories.ts)
## Documentation version

Documentation built with @pibbl/core 0.0.2, revision 272a94a. ALPHA — NOT FOR PRODUCTION USE.
