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

@pagedotapp/page-text

v0.0.0-alpha.14

Published

PageText - A reusable React component

Readme

PageText

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

Installation

npm install @pagedotapp/page-text

Usage

import { PageText } from "@pagedotapp/page-text"

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

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

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

Text Variants

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

Text Sizes

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

Text Utilities

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

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

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

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

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

Semantic HTML

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

Custom Styling

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

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

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 {
	PageTextProps,
	TextElement,
	TextVariant,
	TextSize,
	TextWeight,
	TextAlign,
	TextTransform,
} from "@pagedotapp/page-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