> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# kebabCase es-toolkit

Converts a string to kebab case.

```typescript
const result = kebabCase(str);
```

## Usage

### `kebabCase(str)`

Use `kebabCase` when you want to convert a string to kebab case. Kebab case is a naming convention where each word is written in lowercase and connected with dashes (-).

```typescript
import { kebabCase } from 'es-toolkit/string';

// Convert camel case to kebab case
kebabCase('camelCase');
// Result: 'camel-case'

// Convert a string with whitespace
kebabCase('some whitespace');
// Result: 'some-whitespace'

// Keep strings that are already in kebab case as is
kebabCase('hyphen-text');
// Result: 'hyphen-text'

// Convert strings with uppercase letters
kebabCase('HTTPRequest');
// Result: 'http-request'
```

This function is useful when creating API endpoints, CSS class names, HTML attributes, etc.

#### Parameters


strstringrequired

The string to convert to kebab case.

#### Returns

The string converted to kebab case.

```typescript
string
```


Source: es-toolkit

Re-exported verbatim from [`es-toolkit`](https://es-toolkit.dev/reference/string/kebabCase.html). Implementation, edge cases, and performance behavior are owned upstream. This page mirrors the documentation at the pinned version; the linked source is authoritative.
