Skip to content

Navigation Menu

Sign in
Sign up

Repository files navigation

Material Icons List

This is a simple tool to generate a list of Material Icons available in the Material Icons font. It uses This Repo as a source.

IMPORTANT: This tool requires Internet connection to work.

Rate Limits: This tool uses GitHub's API which has rate limits. For better performance and higher rate limits, set up a GitHub token:

  1. Environment Variable: Set GITHUB_TOKEN environment variable
  2. Or use .env file: Copy env.example to .env and add your token
  3. Get a token: Visit GitHub Settings > Tokens (no special permissions needed)

How to use

As a CLI

# if you want to install it globally
npm i -g milist
milist > output.txt # Uses codepoints source (most comprehensive)
milist --json > output.json # Uses codepoints source with JSON output
milist --ts > material-icons.ts # Uses codepoints source with TypeScript output
milist --source web > web-icons.txt # Uses web source specifically
# if you want to use just once
npx milist > output.txt # Uses codepoints source (most comprehensive)
npx milist --json > output.json # Uses codepoints source with JSON output
npx milist --ts > material-icons.ts # Uses codepoints source with TypeScript output
npx milist --source web > web-icons.txt # Uses web source specifically

As a Library (CommonJs)

const { list } = require('milist');
const icons: string[] = list('web');
console.log(icons); // list of icons in string[] format

As a Library (ESM)

import { list } from 'milist';
const icons: string[] = list('web');
console.log(icons); // list of icons in string[] format

Parameters

--source

  • android: will use the android source
  • ios: will use the ios source
  • web: will use the web source
  • code: will use the codepoints file (most comprehensive list, includes all Material Symbols) [DEFAULT]

Note: If --source is omitted, code is used by default as it provides the most comprehensive list of 4,095+ Material Icons.

Output format

  • --json: With JSON format
  • --text: With simple text format (each name in a new line)
  • --ts: With TypeScript format (const array + type definition)

TypeScript Output Example

// Generated with: milist --ts > material-icons.ts (uses code source by default)
export const icons = [
 "10k",
 "10mp",
 "home",
 "search",
 // ... all 4,095+ icons from codepoints
] as const;
export type MaterialIcon = typeof icons[number];
// Usage in your TypeScript project:
import { icons, MaterialIcon } from './material-icons';
const myIcon: MaterialIcon = "home"; // Type-safe!
const iconExists = icons.includes("search"); // true

Testing

This package includes comprehensive tests:

# Run all tests
npm test
# Run specific test suites
npm run test:simple # Basic functionality tests
npm run test:cli # Command-line interface tests 
npm run test:functional # Real API tests (requires GITHUB_TOKEN)
# Run tests with coverage
npm run test:coverage
# Watch mode for development
npm run test:watch

Note: Functional tests require a GITHUB_TOKEN environment variable for better rate limits when testing against the real GitHub API.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

AltStyle によって変換されたページ (->オリジナル) /