• Stars
    star
    117
  • Rank 292,293 (Top 6 %)
  • Language
    JavaScript
  • License
    Apache License 2.0
  • Created about 6 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Catalog of Material Components for the web (MDC Web)

Material Components for the Web Catalog

This is the catalog of components for Material Components for the web (MDC Web).

About

Material Components for the web (MDC Web) help developers execute Material Design. Developed by a core team of engineers and UX designers at Google, these components enable a reliable development workflow to build beautiful and functional web projects.

Adding a new component

Follow these steps to add a new component to the MDC Web demo catalog.

  1. Add a new file to the src directory for the JSX (e.g. FooCatalog.js). It should follow this template:
import React, { Component } from 'react';
import ComponentCatalogPanel from './ComponentCatalogPanel.js';
import {MDCFoo} from '@material/foo/index';

import './styles/FooCatalog.scss';

const FooCatalog = () => {
  return (
    <ComponentCatalogPanel
      hero={<FooHero />}
      title='Foo'
      description='A short description about the Foo component.'
      designLink='https://material.io/guidelines/components/foo.html'
      docsLink='https://material.io/components/web/catalog/foo/'
      sourceLink='https://github.com/material-components/material-components-web/tree/master/packages/mdc-foo'
      demos={<FooDemos />}
    />
  );
}

class FooHero extends Component {
  // Class methods for JS
  render() {
    return (
      // JSX for the Foo component's hero header
    );
  }
}

class FooDemos extends Component {
  // Class methods for JS
  render() {
    return (
      // JSX for the Foo component demos
    );
  }
}

export default FooCatalog;

NOTE: If your components only require a render method, you can write functional components rather than classes, e.g. function Foo() { ... }. In this case, props are passed in as an argument instead of accessed via this.

  1. Add a new file to the src/styles directory for styling the demo page (e.g. FooCatalog.scss):
@import "@material/foo/mdc-foo";

// Custom styles here
  1. Add a SVG image associated with the component (e.g. foo_180px.svg) to the src/images directory.

  2. Import the SVG and render a new list item inside the render() element in ComponentImageList.js:

import fooImg from './images/foo_180px.svg';

...

class ComponentImageList extends Component {
  ...
  render() {
    return (
      ...
      {this.renderListItem('Foo', fooImg, 'foo')}
    );
  }
}
  1. Add a new entry in the links in the render() method in ComponentSidebar.js:
const links = [
  ...,
  {
    content: 'Foo',
    url: '/foo',
  }
];
  1. Add a <Route> in ComponentPage.js:
import FooCatalog from './FooCatalog';

class ComponentPage extends Component {
  ...
  renderComponentRoutes() {
    ...
    <Route path='/component/foo' component={FooCatalog} />
  }
}

Development

To start a local server of the catalog, run

npm start

Then point your browser to http://localhost:3000/.

Local Testing

To run a build that can be locally tested using any HTTP server:

  1. npm run build
  2. Rename the build folder to material-components-web-catalog
  3. Serve the top-level repository directory (e.g. with live-server)
  4. Browse to http://localhost:/material-components-web-catalog/

Deployment

To deploy the catalog to GitHub pages, run

npm run deploy

You should see it live on https://material-components.github.io/material-components-web-catalog/.

More Repositories

1

material-components-web

Modular and customizable Material Design UI components for the web
TypeScript
17,071
star
2

material-components-android

Modular and customizable Material Design UI components for Android
Java
15,776
star
3

material-web

Material Design Web Components
TypeScript
8,673
star
4

material-components-ios

[In maintenance mode] Modular and customizable Material Design UI components for iOS
Objective-C
4,707
star
5

material-components-android-examples

Companion example apps and code for MDC-Android.
Kotlin
2,486
star
6

material-components-web-react

Material Components for React (MDC React)
TypeScript
2,015
star
7

material-components

Documentation and policies for Material Components (all platforms)
1,060
star
8

material-components-flutter

Modular and customizable Material Design UI components for Flutter
Dart
879
star
9

material-components-android-compose-theme-adapter

A library that enables reuse of Material themes defined in XML for theming in Jetpack Compose.
Kotlin
408
star
10

material-components-android-codelabs

Codelabs for Material Components for Android (MDC-Android)
Java
217
star
11

material-components-flutter-codelabs

Codelabs for Material Components for Flutter
Dart
211
star
12

material-components-android-motion-codelab

Kotlin
173
star
13

material-components-flutter-experimental

Work in progress code, implementation options, and design prototypes
Dart
131
star
14

material-components-web-codelabs

Codelabs for Material Components for Web (MDC Web)
HTML
129
star
15

material-design-for-wordpress

Material Design plugin for WordPress
JavaScript
78
star
16

material-components-site-generator

Generator of Material Components documentation sites.
JavaScript
76
star
17

material-components-flutter-motion-codelab

Codelab for Material motion for Flutter
Dart
55
star
18

material-components-ios-codelabs

Codelabs for Material Components for iOS (MDC-iOS)
Objective-C
38
star
19

material-components-flutter-gallery

Dart
22
star
20

material-components-flutter-codelabs-packages

Assets for Material Flutter codelabs
20
star
21

material-components-design-codelabs

Material Design codelabs for designers
16
star
22

material-components-ios-codelabs-2017

Codelabs for Material Components for iOS (MDC-iOS) 2017
Objective-C
15
star
23

material-components-motion-experimental

Experimental work around motion
5
star
24

material-components-ios-skeleton-objc

A template and sample code that you can use to start a new Material Components for iOS (MDC-iOS) application.
5
star
25

.github

3
star
26

.allstar

1
star