# ModalRoute

`function` in `seedcord` · v0.12.0

<https://docs.seedcord.org/packages/seedcord/0.12.0/functions/modal-route>

Routes modal submissions to handler classes.

Pass the [`CustomId`](/packages/seedcord/0.12.0/classes/custom-id) definition(s) this handler decodes and list the same ones in the handler's generic. Passing different definitions to the decorator and the generic is a compile error. Routing matches the stable prefix, so an older-shape wire still reaches the handler and throws StaleCustomId on read, the same as a button route.

```ts
ModalRoute<Defs>(
    defs: Defs
): <
    TCtor extends new (
        ...args: any[]
    ) => InteractionHandler<Repliables> & HasComponentDefs<Defs>
>(
    constructor: AssertHandles<ModalSubmitInteraction, TCtor>
) => void
```

Routes modal submissions to handler classes.

Pass the [`CustomId`](/packages/seedcord/0.12.0/classes/custom-id) definition(s) this handler decodes and list the same ones in the handler's generic. Passing different definitions to the decorator and the generic is a compile error. Routing matches the stable prefix, so an older-shape wire still reaches the handler and throws StaleCustomId on read, the same as a button route.

Parameters.

- `defs` `Defs` — The customId definition(s) this handler decodes, one per route.

Returns `<TCtor extends new (...args: any[]) => InteractionHandler<Repliables> & HasComponentDefs<Defs>>(constructor: AssertHandles<ModalSubmitInteraction, TCtor>) => void`.
