---
title: "createHref"
source: "https://github.com/remix-run/remix/blob/8905f3943706e1f53696ab83e70a84873cabfc90/packages/route-pattern/src/lib/href.ts#L69"
---

# createHref

## Summary

Generate an href from a route pattern and the supplied params.

Pathname wildcards reject `.` and `..` segments. Generated pathnames have one leading
slash; internal and trailing slashes are preserved.

## Signature

```ts
function createHref<source extends string>(
  pattern: source | RoutePattern<source>,
  args: CreateHrefArgs<source>,
): string

```

## Parameters

### `pattern`

The parsed route pattern.

### `args`

Path params and href options.

## Returns

The generated href string.