> ## Documentation Index
> Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# closeTab

> Close the active tab or a matching tab.

With no target, closes the active tab. To close a specific tab, provide one of
`substring`, `regex`, or `index`.

## Parameters

| Parameter   | Type               | Required | Description                                              |
| ----------- | ------------------ | -------- | -------------------------------------------------------- |
| `substring` | `string`           | No       | Match the URL by substring.                              |
| `regex`     | `string`           | No       | Match the URL by regular expression.                     |
| `index`     | `number \| string` | No       | Zero-based tab index.                                    |
| `timeout`   | `number`           | No       | Maximum time in milliseconds to wait for a matching tab. |

## Shorthand

Bare command. Closes the active tab.

```yaml theme={null}
- closeTab
```

## Examples

```yaml theme={null}
- closeTab:
    substring: blog
```

```yaml theme={null}
- closeTab:
    index: 1
    timeout: 5000
```

## Related

* [Test format](/core-concepts/test-format)
