---
title: "byMode"
description: "Lets one select prop switch between a grid, a radial and a linear layout."
group: "effects"
groupTitle: "Filters & effects"
categoryId: "effects.instances"
categorySlug: "effects-instances"
categoryTitle: "Instances"
kind: "function"
sourceUrl: "https://github.com/shader-effects-inc/shaders/blob/main/packages/core/src/std/effects/instances.ts#L124"
---

# byMode

Lets one select prop switch between a grid, a radial and a linear layout.

```ts
byMode(mode: PropRef, members: PlacementPick['members']): PlacementPick
```

Import `effects` from `shaders/std` and use `effects.instances.byMode`.

`mode` is a compile-time select with the values `'grid'`, `'radial'` and `'linear'`; only the chosen layout is compiled in.

## Parameters

| Name | Type | Notes |
|---|---|---|
| `mode` | `PropRef` |  |
| `members` | `PlacementPick['members']` |  |

## Example

```ts
placement: byMode(p('mode'), {grid: grid({...}), radial: radial({...}), linear: line({...})})
```

## See also

- [`grid`](/docs/primitives/effects-instances/grid) — Copies in rows and columns, filling this layer's bounding box.
- [`radial`](/docs/primitives/effects-instances/radial) — Copies around a circle centred on the layer inside.
- [`line`](/docs/primitives/effects-instances/line) — Copies in a row, marching away from the layer inside in one direction.

## Used by

[Repeater](/docs/components/repeater)