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

***

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

# Function: ComponentWith()

## Call Signature

> **ComponentWith**\<`A`\>(`a`): `A`

Defined in: [flow/src/mixins.ts:107](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L107)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

### Returns

`A`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`\>(`a`, `b`): `B`

Defined in: [flow/src/mixins.ts:108](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L108)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

### Returns

`B`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`\>(`a`, `b`, `c`): `C`

Defined in: [flow/src/mixins.ts:112](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L112)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

### Returns

`C`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`, `D`\>(`a`, `b`, `c`, `d`): `D`

Defined in: [flow/src/mixins.ts:117](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L117)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### D

`D` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

#### d

(`base`) => `D`

### Returns

`D`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`, `D`, `E`\>(`a`, `b`, `c`, `d`, `e`): `E`

Defined in: [flow/src/mixins.ts:123](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L123)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### D

`D` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### E

`E` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

#### d

(`base`) => `D`

#### e

(`base`) => `E`

### Returns

`E`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`, `D`, `E`, `F`\>(`a`, `b`, `c`, `d`, `e`, `f`): `F`

Defined in: [flow/src/mixins.ts:136](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L136)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### D

`D` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### E

`E` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### F

`F` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

#### d

(`base`) => `D`

#### e

(`base`) => `E`

#### f

(`base`) => `F`

### Returns

`F`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`, `D`, `E`, `F`, `G`\>(`a`, `b`, `c`, `d`, `e`, `f`, `g`): `G`

Defined in: [flow/src/mixins.ts:151](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L151)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### D

`D` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### E

`E` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### F

`F` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### G

`G` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

#### d

(`base`) => `D`

#### e

(`base`) => `E`

#### f

(`base`) => `F`

#### g

(`base`) => `G`

### Returns

`G`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```

## Call Signature

> **ComponentWith**\<`A`, `B`, `C`, `D`, `E`, `F`, `G`, `H`\>(`a`, `b`, `c`, `d`, `e`, `f`, `g`, `h`): `H`

Defined in: [flow/src/mixins.ts:168](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/flow/src/mixins.ts#L168)

Compose one or more feature [Mixin](../type-aliases/Mixin)s onto [Component](../classes/Component), folding them left-to-right
so a page can be built from focused, reusable behaviours instead of one bloated class.

### Type Parameters

#### A

`A` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### B

`B` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### C

`C` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### D

`D` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### E

`E` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### F

`F` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### G

`G` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

#### H

`H` *extends* [`Constructor`](../type-aliases/Constructor)\<`object`\>

### Parameters

#### a

(`base`) => `A`

#### b

(`base`) => `B`

#### c

(`base`) => `C`

#### d

(`base`) => `D`

#### e

(`base`) => `E`

#### f

(`base`) => `F`

#### g

(`base`) => `G`

#### h

(`base`) => `H`

### Returns

`H`

a class extending `Component` with every mixin's members mixed in.

### Remarks

Each mixin receives the accumulated base and returns an extended class, so `Component`'s full
surface (`flash()`, `redirect()`, `validate()`, the client magics, …) and every mixin's
`@expose`/`@locked` members flow through to the final page — fully type-checked. Mixin props
register on the mixin prototype, which sits in the page's prototype chain, so snapshot,
reactivity, and client writes all work. Overloads cover 1–8 mixins; nest another
`ComponentWith(...)` call for more. Pages composed this way render via the runtime path rather
than the AOT compiler.

### Example

```tsx
// app/flow/mixins/pagination.ts
import { Component, expose, type Constructor } from "@zerotal/flow";

export function Pagination<T extends Constructor<Component>>(Base: T) {
  abstract class WithPagination extends Base {
    @expose page = 1;
    @expose next() { this.page++; }
  }
  return WithPagination;
}

// app/flow/UsersPage.tsx
class UsersPage extends ComponentWith(Pagination) {
  override async render() {
    return <div data-flow-root>Page {this.page}</div>;
  }
}
```
