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

***

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

# index

Flow — reactive server-side rendering over WebSocket for Zerotal.

You write a [Component](classes/Component) as a server-side class: public state lives on
the instance, `render()` returns server-rendered HTML, and methods marked
[expose](functions/expose) are callable from the browser. When a user interacts, the
action runs on the server, the component re-renders, and only the HTML diff
is streamed back and morphed into the DOM (Alpine-style) — no client-side
component code, no separate API. Snapshots that cross the wire are
HMAC-signed and only [expose](functions/expose)d / [locked](variables/locked) properties are shared.

The toolkit here covers the whole authoring surface: the [Component](classes/Component)
base and [Layout](classes/Layout), the decorator set ([expose](functions/expose), [locked](variables/locked),
[computed](functions/computed), [task](functions/task), [validate](functions/validate), [on](functions/on), [url](functions/url),
[session](functions/session), [presence](functions/presence), [shared](functions/shared), …), [Form](classes/Form)s,
[pagination](functions/paginate), file uploads ([FileUploads](functions/FileUploads)), realtime
presence and cross-client stores, and a library of ready-made view
components ([Modal](functions/Modal), [Link](functions/Link), [Flash](functions/Flash), …).

## Examples

**Register the provider**

```ts
// bootstrap/providers.ts
import { SessionProvider } from "@zerotal/session";
import { FlowProvider } from "@zerotal/flow";

export default [SessionProvider, FlowProvider];
```

**A reactive counter component**

```tsx
import { Component, expose } from "@zerotal/flow";
import type { HtmlNode } from "@zerotal/flow";

export class Counter extends Component {
  count = 0;

  @expose increment(): void {
    this.count++;
  }

  render(): HtmlNode {
    return (
      <button flow:click="increment">
        Clicked {this.count} times
      </button>
    );
  }
}
```

## Remarks

Components are authored in `.tsx` with `jsxImportSource` set to
`@zerotal/flow` (see `@zerotal/flow/jsx-runtime`). Register
`FlowProvider` after `SessionProvider`. Requires **Bun ≥ 1.1**.

## Actions

- [renderless](functions/renderless)
- [task](functions/task)

## Connections

- [flowActiveConnections](functions/flowActiveConnections)
- [FlowConnection](interfaces/FlowConnection)
- [flowConnections](functions/flowConnections)

## Document head

- [Head](functions/Head)
- [Title](functions/Title)

## Exposure & state

- [transient](variables/transient)
- [expose](functions/expose)
- [locked](variables/locked)

## Feedback

- [Flash](functions/Flash)
- [Skeleton](functions/Skeleton)
- [Loading](functions/Loading)
- [Alert](functions/Alert)

## Flash

- [FlashPosition](type-aliases/FlashPosition)
- [FlashActionVariant](type-aliases/FlashActionVariant)
- [FlashActionStyle](interfaces/FlashActionStyle)
- [FlashAction](interfaces/FlashAction)
- [FlashCallback](interfaces/FlashCallback)
- [FlashMessage](interfaces/FlashMessage)

## Forms & inputs

- [Errors](functions/Errors)
- [ErrorMessage](functions/ErrorMessage)
- [FileUpload](functions/FileUpload)

## Frames

- [CallFrame](interfaces/CallFrame)
- [PatchFrame](interfaces/PatchFrame)
- [FlashFrame](interfaces/FlashFrame)
- [RedirectFrame](interfaces/RedirectFrame)
- [ErrorFrame](interfaces/ErrorFrame)
- [EventFrame](interfaces/EventFrame)
- [DownloadFrame](interfaces/DownloadFrame)

## Headless components

- [Switch](functions/Switch)
- [Disclosure](functions/Disclosure)
- [Accordion](functions/Accordion)
- [Popover](functions/Popover)
- [Checkbox](functions/Checkbox)
- [Select](functions/Select)
- [RadioGroup](functions/RadioGroup)
- [Listbox](functions/Listbox)
- [Combobox](functions/Combobox)
- [Label](functions/Label)
- [Description](functions/Description)
- [Field](functions/Field)
- [Legend](functions/Legend)
- [Fieldset](functions/Fieldset)

## Navigation & data

- [Link](functions/Link)
- [Persist](functions/Persist)
- [InfiniteScroll](functions/InfiniteScroll)
- [For](functions/For)
- [Pager](functions/Pager)
- [Table](functions/Table)

## Other

### defineStore

Re-exports [defineStore](../store/functions/defineStore)

***

### FlowStore

Re-exports [FlowStore](../store/interfaces/FlowStore)

## Overlays

- [Modal](functions/Modal)
- [Dropdown](functions/Dropdown)
- [Tabs](functions/Tabs)
- [Tooltip](functions/Tooltip)
- [Drawer](functions/Drawer)

## Persistence

- [UrlOptions](interfaces/UrlOptions)
- [url](functions/url)
- [param](functions/param)
- [session](functions/session)

## Provider

- [FlowProvider](classes/FlowProvider)

## Reactivity

- [computed](functions/computed)
- [reactive](variables/reactive)
- [modelable](variables/modelable)

## Realtime

- [PresenceChannel](type-aliases/PresenceChannel)
- [presence](functions/presence)
- [SharedChannel](type-aliases/SharedChannel)
- [shared](functions/shared)
- [on](functions/on)
- [FlowEvents](interfaces/FlowEvents)
- [EventName](type-aliases/EventName)
- [EventPayload](type-aliases/EventPayload)
- [registerFlowEvent](functions/registerFlowEvent)
- [WebSocketConnected](classes/WebSocketConnected)
- [WebSocketDisconnected](classes/WebSocketDisconnected)
- [FlowActionHandled](classes/FlowActionHandled)

## Snapshot

- [SnapshotData](type-aliases/SnapshotData)
- [ChildMemo](interfaces/ChildMemo)
- [SnapshotMemo](interfaces/SnapshotMemo)
- [Snapshot](interfaces/Snapshot)

## Validation

- [validate](functions/validate)
- [ValidationRules](type-aliases/ValidationRules)
- [ValidationError](classes/ValidationError)
