lorem-ipsum-react
v1.0.1
Published
Generate random paragraphs of Lorem Ipsum text in React.
Maintainers
Readme
lorem-ipsum-react
Generate random paragraphs of Lorem Ipsum text in React.
✨ Zero dependencies 📍 React 19 support
Install
npm install react-loremUsage
<Lorem /> component
Renders lorem ipsum paragraphs.
import { Lorem } from "react-lorem";
function App() {
return <Lorem count={3} />;
}Props
| Prop | Type | Default | Description |
| -------------------------- | --------------- | ---------- | ------------------------------------------ |
| count | number | required | Number of paragraphs to generate |
| seed | number | random | Seed for deterministic output |
| startWithLoremIpsum | boolean | true | Start with "Lorem ipsum dolor sit amet..." |
| minWordsPerSentence | number | 4 | Minimum words per sentence |
| maxWordsPerSentence | number | 16 | Maximum words per sentence |
| minSentencesPerParagraph | number | 3 | Minimum sentences per paragraph |
| maxSentencesPerParagraph | number | 7 | Maximum sentences per paragraph |
| Wrapper | React Component | p | Component to wrap each paragraph |
Custom wrapper
Use the Wrapper prop to customize the component that wraps each paragraph.
function Paragraph({ children }) {
return <p className="text-gray-500 my-4">{children}</p>;
}
<Lorem count={3} Wrapper={Paragraph} />;generateParagraphs()
Use the generator directly without React.
import { generateParagraphs } from "react-lorem";
const paragraphs = generateParagraphs({ count: 2 });
// => ["Lorem ipsum dolor sit amet...", "..."]License
MIT
