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

```ts twoslash
// @include: imports
const limitOptions: <TOption>({
  cursor,
  options,
  style,
  output,
  maxItems,
  columnPadding,
  rowPadding,
}) => string[];
```

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

Trims an option list to what fits the terminal, while keeping the active
option (cursor) visible using a Clack style sliding window.

## Type Parameters

&#x20;`TOption`

## Parameters

`{ cursor, options, style, output, maxItems, columnPadding, rowPadding, }`

[`LimitOptionsParams`](prompts.Interface.LimitOptionsParams.md)<`TOption`>

## Returns

`string`\[]

The lines to render.

## See

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

## Example

```ts twoslash
// @include: imports
import { limitOptions } from "@clack/prompts";
import { styleText } from "node:util";

const options = ["apple", "banana", "cherry", "date"];
const lines = limitOptions({
  options,
  cursor: 2,
  maxItems: 8,
  style: (opt, active) =>
    active ? styleText("cyan", opt) : styleText("dim", opt),
});
```
