# signal

`signal(initialValue, options?)` returns a [`WritableSignal`](/reference/types/canvas-runtime/#writablesignal).
Read with `get()`, replace with `set(value)`, update from the current value with
`update(updater)`, and obtain a cached readonly view with `asReadonly()`.
Equality defaults to `Object.is`; `set()` treats functions as data.

Signal reads performed while a component evaluates become that component's
dependencies. Pibbl-provided components also resolve signals at declared
signal-valued props, style fields, and child inputs; the receiving component
then owns the dependency. Pibbl never deep-unwraps arbitrary application data.

See [Use signals and animation](/guides/signals-and-animation/).

Related types: [`Signal`](/reference/types/canvas-runtime/#signal),
[`WritableSignal`](/reference/types/canvas-runtime/#writablesignal), and
[`SignalOptions`](/reference/types/canvas-runtime/#signaloptions).

## API details from source

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

Creates a synchronous writable signal with configurable equality and an optional diagnostic
name.

```ts
signal: <T>(initialValue: T, options?: SignalOptions<T>) => WritableSignal<T>
```

Related API: [signal](/reference/functions/signal/), [SignalOptions](/reference/types/canvas-runtime/#signaloptions), [WritableSignal](/reference/types/canvas-runtime/#writablesignal).

### Parameters

- **`initialValue`** — Value stored before the first write.

- **`options`** — Equality comparison and optional diagnostic name. See [SignalOptions](/reference/types/canvas-runtime/#signaloptions).

### Returns

A writable signal holding the initial value. See [WritableSignal](/reference/types/canvas-runtime/#writablesignal).

### See also

[SignalOptions](/reference/types/canvas-runtime/#signaloptions)

[WritableSignal](/reference/types/canvas-runtime/#writablesignal)

[View source — packages/core/src/lib/signals/graph.ts:521](/source/packages/core/src/lib/signals/graph-ts/#L521)

## Implementation guidance for agents

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

## Complete minimal examples

- [Read and update signals](/minimal-examples/lifecycle/signals/): Use writable, readonly, and computed values with synchronous batching. [Plain source](/minimal/lifecycle/signals.ts)
## Documentation version

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