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

my-material-theme-ui-components

v1.0.0

Published

These UI components are based on the Material Design guidelines and are built with React, TypeScript, and Styled Components.

Readme

my-material-theme-ui-components

A premium, dynamic-themed React design system component library built with TypeScript and styled-components. It generates complete, accessible, and responsive color palettes (surfaces, accents, and text contrasts) dynamically from a single primary color input.


Features

  • Dynamic Theme Palette Engine: Supply a single primary hex color (e.g. #1A73E8), and the library automatically calculates:
    • Accessible, high-contrast text colors (primaryText, secondaryTextHigh, primaryContrastText).
    • Lighter background tints and surfaces (surfaceDefault, surfaceHigh).
    • Active and hover modifiers (primaryHigh).
    • Standard status colors (success, warning, danger, info).
  • Premium Components: Fully type-safe React components including Modal, ImageCard, Button, Badge, forms, loaders, tooltips, and containers.
  • Backwards Compatibility: Can be configured globally (singleton pattern) or dynamically using styled-components' <ThemeProvider>.

Installation

Install the package and its peer dependencies:

npm install my-material-theme-ui-components styled-components tinycolor2

Theme Configuration

You can customize the theme using two main approaches:

1. Global Setup (Singleton Pattern)

Call configureTheme early in your application entry point (e.g., main.tsx or index.tsx). All default styled-components will fall back to this configuration automatically.

import { configureTheme } from 'my-material-theme-ui-components';

// This dynamically calculates matches for surface, contrast text, etc.
configureTheme('#1A73E8');

2. Contextual Theme Provider

Wrap your application in styled-components' ThemeProvider and pass the dynamically generated theme object.

import React, { useState } from 'react';
import { ThemeProvider } from 'styled-components';
import { generateThemeColors, RootElement, Button } from 'my-material-theme-ui-components';

function App() {
  // Generate the full theme palette object from one color
  const theme = generateThemeColors('#0F9D58');

  return (
    <ThemeProvider theme={theme}>
      <RootElement $padding="24px">
        <Button>Theme Adaptive Button</Button>
      </RootElement>
    </ThemeProvider>
  );
}

Color Tokens

The generated theme contains the following design tokens:

| Token Name | Description | | :--- | :--- | | primary | The base brand color (e.g. #1A73E8). | | primaryHigh | A slightly modified primary color for hover/focus states. | | primaryText | A highly readable, dark tint of the primary color for body/heading copy. | | primaryContrastText | High-contrast text designed to render on top of the primary color background (#ffffff for dark themes, dark text for light themes). | | secondaryTextHigh | Medium-contrast descriptive text (e.g. captions and subheadings). | | surfaceDefault | Desaturated, light background surface color. | | surfaceHigh | Slightly lighter elevation surface color (e.g. for cards and nav bars). | | success / warning / danger / info | Standardized status colors. |


Component Usage Examples

Primary Button and Badge

import { Button, Badge } from 'my-material-theme-ui-components';

function Example() {
  return (
    <div style={{ display: 'flex', gap: '12px' }}>
      <Button onClick={() => alert('Clicked!')}>Filled Button</Button>
      <Badge variant="filled" colorType="primary">Primary Tag</Badge>
      <Badge variant="filled" colorType="success">Completed</Badge>
    </div>
  );
}

Form Input and Error Validation

import { Input, TextArea } from 'my-material-theme-ui-components';

function FormExample() {
  return (
    <form>
      <Input label="Username" placeholder="Enter username" />
      <Input label="Email Address" placeholder="[email protected]" error="Invalid email address" />
      <TextArea label="Comments" placeholder="Type here..." />
    </form>
  );
}

Aspect-Ratio Hover Zoom Card

import { ImageCard } from 'my-material-theme-ui-components';

function CardExample() {
  return (
    <ImageCard
      title="Dynamic Showcase"
      subtitle="React Component Library"
      description="Interactive aspect-ratio hover magnification card."
      imageUrl="https://images.unsplash.com/photo-1507238691740-187a5b1d37b8?q=80&w=600"
    />
  );
}

License

MIT