---
url: /reference/api/logger/prompts.Variable.group.md
---
# Variable: group

```ts twoslash
// @include: imports
const group: <T>(
  prompts,
  opts?,
) => Promise<Prettify<PromptGroupAwaitedReturn<T>>>;
```

Defined in: node\_modules/.pnpm/@clack+prompts@1.9.0/node\_modules/@clack/prompts/dist/index.d.mts:458

The `group` utility provides a consistent way to combine a series of prompts,
combining each answer into one object. Each prompt receives the results of
all previously completed prompts, and are displayed sequentially.

## Type Parameters

&#x20;`T`

## Parameters

`prompts`

[`PromptGroup`](prompts.TypeAlias.PromptGroup.md)<`T`>

`opts?`

[`PromptGroupOptions`](prompts.Interface.PromptGroupOptions.md)<`T`>

## Returns

`Promise`<`Prettify`<[`PromptGroupAwaitedReturn`](prompts.TypeAlias.PromptGroupAwaitedReturn.md)<`T`>>>

## See

https://bomb.sh/docs/clack/packages/prompts/#group

## Example

```ts twoslash
// @include: imports
import { group, text, password } from "@clack/prompts";

const account = await group({
  email: () =>
    text({
      message: "What is your email address?",
    }),
  username: ({ results }) =>
    text({
      message: "What is your username?",
      placeholder: results.email?.replace(/@.+$/, "").toLowerCase() ?? "",
    }),
  password: () =>
    password({
      message: "Define your password",
    }),
});
```
