Skip to content

Banegasn/components

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

146 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Material 3 Expressive Web Components Library

Material Web Components Repository

A growing collection of reusable, framework-agnostic web components built with modern technologies. This monorepo leverages Turborepo and PNPM Workspaces to efficiently manage multiple web component packages.

License: MIT PNPM Turborepo

🎨 Web Components

This repository contains a collection of web components that can be used in any JavaScript framework or vanilla JavaScript. Currently available:

πŸ“š Documentation

🌐 Live Demo

The Angular demo app is automatically deployed to GitHub Pages: https://banegasn.github.io/components/

Every push to the main branch triggers an automatic deployment.

πŸ—οΈ Architecture

This monorepo is designed for building and distributing web components:

  • Framework-agnostic components: Built with Lit, Svelte, and other modern web component technologies
  • Universal compatibility: Components work in any JavaScript framework (Angular, React, Vue, etc.) or vanilla JavaScript
  • Efficient builds: Turborepo for intelligent build caching and parallelization
  • Workspace management: PNPM for fast, disk-efficient dependency management
  • Demo applications: Example apps showcasing component usage in different frameworks

πŸ“ Project Structure

.
β”œβ”€β”€ apps/
β”‚   └── angular-app/          # Angular demo showcasing all web components
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ m3-badge/
β”‚   β”œβ”€β”€ m3-button/
β”‚   β”œβ”€β”€ m3-card/
β”‚   β”œβ”€β”€ m3-checkbox/
β”‚   β”œβ”€β”€ m3-chip/
β”‚   β”œβ”€β”€ m3-dialog/
β”‚   β”œβ”€β”€ m3-divider/
β”‚   β”œβ”€β”€ m3-fab-menu/
β”‚   β”œβ”€β”€ m3-icon-button/
β”‚   β”œβ”€β”€ m3-list/
β”‚   β”œβ”€β”€ m3-loading-indicator/
β”‚   β”œβ”€β”€ m3-menu/
β”‚   β”œβ”€β”€ m3-navigation-bar/
β”‚   β”œβ”€β”€ m3-navigation-rail/
β”‚   β”œβ”€β”€ m3-progress/
β”‚   β”œβ”€β”€ m3-radio-button/
β”‚   β”œβ”€β”€ m3-search-bar/
β”‚   β”œβ”€β”€ m3-slider/
β”‚   β”œβ”€β”€ m3-snackbar/
β”‚   β”œβ”€β”€ m3-split-button/
β”‚   β”œβ”€β”€ m3-switch/
β”‚   β”œβ”€β”€ m3-tabs/
β”‚   β”œβ”€β”€ m3-text-field/
β”‚   β”œβ”€β”€ m3-top-app-bar/
β”‚   β”œβ”€β”€ m3-tooltip/
β”‚   └── svelte-components/
β”œβ”€β”€ scripts/                  # Build, publish, and screenshot utilities
β”œβ”€β”€ pnpm-workspace.yaml
β”œβ”€β”€ turbo.json
└── tsconfig.json

πŸš€ Quick Start

Use via CDN (No build step)

You can use the components directly in any HTML file without installing anything by using the jsDelivr CDN and its ES module features:

<!-- Import directly as a module -->
<script
  type="module"
  src="https://cdn.jsdelivr.net/npm/@banegasn/m3-button/+esm"
></script>

<!-- Or import multiple components -->
<script type="module">
  import 'https://cdn.jsdelivr.net/npm/@banegasn/m3-button/+esm';
  import 'https://cdn.jsdelivr.net/npm/@banegasn/m3-card/+esm';
</script>

<!-- Use the components -->
<m3-button variant="filled">Click me</m3-button>

Build from source / Install locally

Prerequisites

  • Node.js 24.18.x
  • pnpm 11.12.0

Enable the pinned pnpm version with Corepack:

npm install --global corepack@0.35.0
corepack enable
corepack install --global pnpm@11.12.0

Installation

# Clone the repository
git clone <repository-url>
cd components

# Install dependencies
pnpm install

# Build all packages and apps
pnpm build

# Run development servers
pnpm dev

πŸ› οΈ Development

Build Commands

# Build all packages and apps
pnpm build

# Build specific package
pnpm --filter @banegasn/m3-button build

# Build specific app
pnpm --filter angular-app build

Development Commands

# Run all dev servers
pnpm dev

# Run specific package in dev mode
cd packages/example-component
pnpm dev

# Run specific app
cd apps/angular-app
pnpm dev

The Angular app will be available at http://localhost:4200

Other Commands

# Run linters
pnpm lint

# Type-check every workspace (including existing browser tests)
pnpm typecheck

# Run tests
pnpm test

# Pack, install, and import every public package (run after pnpm build)
pnpm smoke:packages

# Clean all build artifacts
pnpm clean

Quality checks

The supported local toolchain is Node.js 24.18.x with pnpm 11.12.0. Use the version pinned in .nvmrc, then run:

corepack enable
pnpm install --frozen-lockfile
pnpm test:browser:install
pnpm lint
pnpm typecheck
pnpm test
pnpm build

pnpm test runs the existing browser suites with Playwright. Workspaces that do not have tests yet print an explicit temporary status instead of being silently skipped; adding their behavioral coverage is tracked in issue #12.

Formatting uses the shared Prettier policy:

pnpm format

🎯 Demo Applications

angular-app

A demonstration Angular application showcasing how to use the web components in a real-world application.

Features:

  • Angular 20 with standalone components
  • Live examples of all available web components
  • Integration patterns and best practices
  • Deployed to GitHub Pages for live preview

Run:

cd apps/angular-app
pnpm dev

πŸ’‘ Note: More demo apps (React, Vue, vanilla JS) may be added in the future to demonstrate cross-framework compatibility.

πŸ”§ Turborepo Configuration

The turbo.json file defines the build pipeline:

  • build: Builds all packages with dependency awareness
  • dev: Runs all development servers
  • lint: Runs linters across the monorepo
  • test: Runs tests with proper dependencies
  • clean: Cleans build artifacts

Key Features:

  • Caching: Turborepo caches build outputs for faster rebuilds
  • Parallelization: Runs independent tasks in parallel
  • Dependency graph: Ensures packages build in the correct order

πŸ“ Adding New Web Components

Add a new component package:

  1. Create package directory:
mkdir -p packages/my-web-component/src
  1. Create package.json:
{
  "name": "@banegasn/my-web-component",
  "version": "1.0.0",
  "type": "module",
  "main": "./dist/index.js",
  "types": "./dist/index.d.ts",
  "scripts": {
    "build": "tsc",
    "dev": "tsc --watch"
  }
}
  1. Create your web component using Lit, Svelte, or vanilla JavaScript

  2. Install dependencies from root:

pnpm install

Add a new demo app:

  1. Create app directory:
mkdir -p apps/my-demo-app
  1. Set up your framework (React, Vue, etc.)

  2. Add workspace dependencies in package.json:

{
  "dependencies": {
    "@banegasn/m3-button": "workspace:*",
    "@banegasn/m3-card": "workspace:*",
    "@banegasn/m3-navigation-bar": "workspace:*",
    "@banegasn/m3-navigation-rail": "workspace:*",
    "@banegasn/m3-switch": "workspace:*",
    "@banegasn/m3-radio-button": "workspace:*",
    "@banegasn/m3-search-bar": "workspace:*",
    "@banegasn/m3-fab-menu": "workspace:*",
    "@banegasn/m3-loading-indicator": "workspace:*",
    "@banegasn/m3-menu": "workspace:*",
    "@banegasn/m3-split-button": "workspace:*"
  }
}

πŸ§ͺ Testing

Add test scripts to individual packages:

{
  "scripts": {
    "test": "vitest"
  }
}

Run all tests:

pnpm test

🚒 Building for Production

Build all packages and apps:

pnpm build

Turborepo will:

  1. Build packages in dependency order
  2. Cache successful builds
  3. Only rebuild what changed

Build for GitHub Pages:

pnpm build:gh-pages

This builds all packages and the Angular app optimized for GitHub Pages deployment with the correct base href (/components/).

πŸ“€ Publishing Web Components

To publish web component packages to GitHub Packages (or npm):

# Bump version
pnpm version:patch  # or version:minor, version:major

# Publish to npm
pnpm publish:npm

# Publish to GitHub Packages
pnpm publish:github

All web components are published as individual npm packages that can be installed and used in any project.

See PUBLISHING.md for detailed publishing instructions and GitHub Actions setup.

πŸ“š Best Practices for Web Components

  1. Framework-agnostic: Design components to work in any framework or vanilla JavaScript
  2. Use workspace protocol: Reference workspace packages with workspace:*
  3. Shared configs: Extend root tsconfig.json for consistency
  4. Custom elements: Follow web component standards and naming conventions (kebab-case)
  5. Semantic versioning: Version packages independently
  6. Documentation: Keep README files updated in each package with usage examples
  7. Accessibility: Ensure components follow WCAG guidelines and support keyboard navigation

πŸ” Troubleshooting

Clear all caches:

pnpm clean
rm -rf node_modules pnpm-lock.yaml
pnpm install

Clear Turborepo cache:

rm -rf .turbo

Reinstall dependencies:

pnpm install --force

πŸ“– Resources

Web Components

Monorepo Tools

Framework Integration

🀝 Contributing

Read CONTRIBUTING.md for repository setup, architecture, quality checks, pull request requirements, semantic-versioning guidance, and the autonomous-agent workflow. All participation is governed by the Code of Conduct. Report vulnerabilities privately by following SECURITY.md.

πŸ“„ License

MIT

About

Material 3 Expressive - Web Components - Material Web Implementation

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

40 stars

Watchers

3 watching

Forks

Packages

 
 
 

Contributors