https://github.com/martpie/react-slugify
Slugify a React node
https://github.com/martpie/react-slugify
react reactjs slug slugify
Last synced: 11 months ago
JSON representation
Slugify a React node
- Host: GitHub
- URL: https://github.com/martpie/react-slugify
- Owner: martpie
- License: mit
- Created: 2018-11-19T12:08:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2025-08-05T13:10:00.000Z (11 months ago)
- Last Synced: 2025-08-05T13:21:29.026Z (11 months ago)
- Topics: react, reactjs, slug, slugify
- Language: TypeScript
- Homepage:
- Size: 343 KB
- Stars: 25
- Watchers: 2
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# react-slugify

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(Yes it works like that too);
// -> "yes-it-works-like-that-too"
slugify(
<>
and
with
fragments or arrays
>
);
// -> "and-with-fragments-or-arrays"
slugify(
Crème brulée receipe
, { delimiter: '_' });
// -> creme_brulee_receipe
slugify(
Crème brulée receipe
, { prefix: 'user-content' });
// -> user-content-creme-brulee-receipe
slugify(
Crème brulée receipe
, {
delimiter: '_',
prefix: 'user-content',
});
// -> user-content_creme_brulee_receipe
```