useLoremIpsum

A React Hook that helps to generate Lorem Ipsum text. Useful for testing and placeholder text.

Demo

Source
[Stable] Occaecat amet minim ex ut aliquip dolore non esse ea.
[Unstable] Veniam nostrud cillum tempor nisi, labore labore, proident duis cupidatat!
[Length: 2] Deserunt reprehenderit incididunt, commodo proident exercitation in. Enim adipiscing minim dolore in magna amet proident sit voluptate!

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const text = useLoremIpsum(length) // 1 sentence by default
const text = useLoremIpsum(options)

Length

A number that represents the number of sentences to generate.

Options

export interface UseLoremIpsumOptions {
  /**
   * The length of the generated text sentence.
   *
   * @defaultValue 1
   */
  length?: number
  /**
   * The minimum number of words in a sentence.
   *
   * @defaultValue ['.', '!', '?']
   */
  sentenceEnds?: string[]
  /**
   * Whether to keep the same value between renders.
   *
   * @defaultValue true
   */
  stable?: boolean
}

Returns

A string that represents the generated text.