[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/flow](../../README) / [index](../README) / param

# Function: param()

## Call Signature

> **param**(`value`, `context`): `void`

Defined in: [flow/src/decorators.ts:905](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/decorators.ts#L905)

Fills a field from the matched route segment before `onMount()` runs — including a
[route-model binding](/docs/routing#route-model-binding), so a page on `/posts/:post`
receives the loaded `Post` without querying for it.

### Parameters

#### value

`unknown`

#### context

`ClassFieldDecoratorContext`

### Returns

`void`

When configured, a field decorator; when used bare, nothing (applied directly).

### Remarks

Usable bare as `@param` (the field's own name is the segment), as `@param('slug')` to read a
differently-named segment, or as `@param(Post)` to take whichever segment resolved to an
instance of that model — so the field never has to track what a route called it. One model
claims one segment name, so the token form is unambiguous for anything binding implicitly;
a route that hand-binds a second segment to the same model yields the leftmost.

Seeding happens **once, on the initial GET** — the only request that carries the URL's
segments. On subsequent WebSocket actions the value is restored from the snapshot instead
(a model through Flow's model synth), so pair it with `@locked` and the record is never
re-queried.

`@param` registers the binding only; combine it with `@locked` for server-owned data, or
`@expose` if the client may also write it. Applies to a field.

### Example

```tsx
class PostDetailPage extends Component {
  @locked @param post!: Post;           // /posts/:post -> the bound Post
  @locked @param(Post) article!: Post;  // whichever segment resolved to a Post
  @locked @param("tab") activeTab = ""; // /posts/:post/:tab -> the raw segment
}
```

## Call Signature

> **param**(`source?`): `ParamDecorator`

Defined in: [flow/src/decorators.ts:906](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/decorators.ts#L906)

Fills a field from the matched route segment before `onMount()` runs — including a
[route-model binding](/docs/routing#route-model-binding), so a page on `/posts/:post`
receives the loaded `Post` without querying for it.

### Parameters

#### source?

`string` \| `ParamModel`

### Returns

`ParamDecorator`

When configured, a field decorator; when used bare, nothing (applied directly).

### Remarks

Usable bare as `@param` (the field's own name is the segment), as `@param('slug')` to read a
differently-named segment, or as `@param(Post)` to take whichever segment resolved to an
instance of that model — so the field never has to track what a route called it. One model
claims one segment name, so the token form is unambiguous for anything binding implicitly;
a route that hand-binds a second segment to the same model yields the leftmost.

Seeding happens **once, on the initial GET** — the only request that carries the URL's
segments. On subsequent WebSocket actions the value is restored from the snapshot instead
(a model through Flow's model synth), so pair it with `@locked` and the record is never
re-queried.

`@param` registers the binding only; combine it with `@locked` for server-owned data, or
`@expose` if the client may also write it. Applies to a field.

### Example

```tsx
class PostDetailPage extends Component {
  @locked @param post!: Post;           // /posts/:post -> the bound Post
  @locked @param(Post) article!: Post;  // whichever segment resolved to a Post
  @locked @param("tab") activeTab = ""; // /posts/:post/:tab -> the raw segment
}
```
