# react-slugify

> Slugify a React node

Latest version **5.0.0** (published 2025-08-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-slugify
pnpm add react-slugify
yarn add react-slugify
bun add react-slugify
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.0 |
| Published | 2025-08-05 |
| First published | 2018-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 19.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26 |
| Author | Pierre de la Martiniere |
| Maintainers | martpie |
| Keywords | react, slug, slugify, vanity, url, markdown |

## Links

- npm: https://www.npmjs.com/package/react-slugify
- Repository: https://github.com/martpie/react-slugify
- Homepage: https://github.com/martpie/react-slugify#readme
- Issues: https://github.com/martpie/react-slugify/issues
- npm.io page: https://npm.io/package/react-slugify

## Dependencies (1)

- [diacritics](https://npm.io/package/diacritics.md) ^1.3.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 5.0.0 (latest) — 2025-08-05
- 4.0.1 — 2024-06-17
- 4.0.0 — 2024-06-05
- 3.0.3 — 2023-10-27
- 3.0.2 — 2023-01-21
- 3.0.1 — 2023-01-19
- 3.0.0 — 2023-01-06
- 2.1.0 — 2021-10-09
- 2.0.4 — 2021-09-16
- 2.0.3 — 2020-12-11
- 2.0.2 — 2020-09-14
- 2.0.1 — 2019-10-23
- 2.0.0 — 2019-10-23
- 1.2.0 — 2019-03-15
- 1.1.1 — 2018-11-22
- … 4 more at https://npm.io/package/react-slugify/versions

## README

# react-slugify

![Build status](https://github.com/martpie/react-slugify/workflows/tests/badge.svg)

Slugify a React node.

## Usage

### `slugify(node[, options])`

- `node` String, Number, Fragment, Array of nodes
- `options` Object (optional)
  - `delimiter` String (default is `'-'`)
  - `prefix` String (default is `''`)

## Examples

```tsx
import slugify from 'react-slugify';

slugify('something I want to test');
// -> "something-i-want-to-test"

slugify(<span>Yes it works like that too</span>);
// -> "yes-it-works-like-that-too"

slugify(
  <>
    <span>and</span>
    <span>with</span>
    <span>fragments or arrays</span>
  </>
);
// -> "and-with-fragments-or-arrays"

slugify(<h3>Crème brulée receipe</h3>, { delimiter: '_' });
// -> creme_brulee_receipe

slugify(<h3>Crème brulée receipe</h3>, { prefix: 'user-content' });
// -> user-content-creme-brulee-receipe

slugify(<h3>Crème brulée receipe</h3>, {
  delimiter: '_',
  prefix: 'user-content',
});
// -> user-content_creme_brulee_receipe
```

---
_Source: https://npm.io/package/react-slugify · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
