npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@simpledotstudio/simple-text

v2.0.0

Published

SimpleText - A reusable React component

Readme

SimpleText

A flexible text component that can render various HTML text elements with consistent styling and typography options.

Installation

npm install @simpledotstudio/simple-text

Usage

import { SimpleText } from '@simpledotstudio/simple-text';

function App() {
  return (
    <>
      <SimpleText as="h1">Main Heading</SimpleText>
      <SimpleText as="p" variant="muted">
        This is a paragraph with muted text color.
      </SimpleText>
      <SimpleText as="strong" variant="primary">
        Important text
      </SimpleText>
    </>
  );
}

Props

| Prop | Type | Default | Description | |------|------|---------|-------------| | children | React.ReactNode | - | Text content | | as | TextElement | 'p' | HTML element to render (h1-h6, p, span, strong, em, etc.) | | variant | TextVariant | 'default' | Visual variant (default, primary, secondary, muted, success, warning, danger, info) | | size | TextSize | Based on element | Text size (xs, sm, md, lg, xl, 2xl, 3xl, 4xl, 5xl) | | weight | TextWeight | Based on element | Font weight (thin, light, normal, medium, semibold, bold, extrabold, black) | | align | TextAlign | - | Text alignment (left, center, right, justify) | | transform | TextTransform | - | Text transformation (uppercase, lowercase, capitalize) | | truncate | boolean | false | Whether text should be truncated with ellipsis | | maxLines | number | - | Maximum number of lines before truncating (requires truncate) | | preserveWhitespace | boolean | false | Whether to preserve whitespace | | className | string | '' | Additional CSS class name | | onClick | function | - | Click handler |

Examples

Headings

<SimpleText as="h1">Page Title</SimpleText>
<SimpleText as="h2" variant="primary">Section Heading</SimpleText>
<SimpleText as="h3" weight="medium">Subsection</SimpleText>

Text Variants

<SimpleText variant="default">Default text</SimpleText>
<SimpleText variant="primary">Primary text</SimpleText>
<SimpleText variant="secondary">Secondary text</SimpleText>
<SimpleText variant="muted">Muted text</SimpleText>
<SimpleText variant="success">Success text</SimpleText>
<SimpleText variant="warning">Warning text</SimpleText>
<SimpleText variant="danger">Error text</SimpleText>
<SimpleText variant="info">Info text</SimpleText>

Text Sizes

<SimpleText size="xs">Extra small text</SimpleText>
<SimpleText size="sm">Small text</SimpleText>
<SimpleText size="md">Medium text</SimpleText>
<SimpleText size="lg">Large text</SimpleText>
<SimpleText size="xl">Extra large text</SimpleText>
<SimpleText size="2xl">2X large text</SimpleText>

Text Utilities

// Truncation
<SimpleText truncate>
  This is a very long text that will be truncated with ellipsis
</SimpleText>

// Multi-line truncation
<SimpleText truncate maxLines={3}>
  This is a very long text that spans multiple lines
  and will be truncated after 3 lines with ellipsis...
</SimpleText>

// Text alignment
<SimpleText align="center">Centered text</SimpleText>
<SimpleText align="right">Right-aligned text</SimpleText>

// Text transformation
<SimpleText transform="uppercase">uppercase text</SimpleText>
<SimpleText transform="capitalize">capitalized text</SimpleText>

// Preserve whitespace
<SimpleText preserveWhitespace>
  Text   with   multiple   spaces
  and line breaks preserved
</SimpleText>

Semantic HTML

<SimpleText as="strong">Bold/important text</SimpleText>
<SimpleText as="em">Emphasized text</SimpleText>
<SimpleText as="small">Small print</SimpleText>
<SimpleText as="mark">Highlighted text</SimpleText>
<SimpleText as="del">Deleted text</SimpleText>
<SimpleText as="ins">Inserted text</SimpleText>
<SimpleText as="code">console.log('Code text')</SimpleText>
<SimpleText as="blockquote">
  "This is a blockquote"
</SimpleText>

Custom Styling

// Override default size/weight
<SimpleText as="h1" size="md" weight="normal">
  Small, normal weight heading
</SimpleText>

// Add custom className
<SimpleText className="custom-text-class">
  Text with custom styling
</SimpleText>

Smart Defaults

The component automatically applies appropriate default sizes and weights based on the element type:

  • Headings (h1-h6): Bold weight with progressively smaller sizes
  • Strong: Bold weight
  • Label/Legend: Medium weight
  • Small/Code: Small size

These defaults can be overridden using the size and weight props.

TypeScript

The component exports the following types:

import type {
  SimpleTextProps,
  TextElement,
  TextVariant,
  TextSize,
  TextWeight,
  TextAlign,
  TextTransform
} from '@simpledotstudio/simple-text';

Styling

The component uses CSS modules for styling. You can override styles by passing a custom className or by targeting the component's CSS classes in your global styles.

Development

To run the component in development mode:

npm run storybook

To run tests:

npm run test

To lint the component:

npm run lint