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 🙏

© 2024 – Pkg Stats / Ryan Hefner

material-ui-mix-icon

v0.2.6

Published

<ComposedIcon> component for material-ui

Downloads

65

Readme

material-ui-mix-icon - <CombineIcon>

npm npm bundle size NPM

Combine 2 icons for extra status display, exception notation or variance presentation.

WHY: When having a simple icon to describe one element, sometimes, the element being flavored in specific ways needs a consistent way to describe complex states; e.g:

  • User vs User with Admin Privileges
  • Server vs Server provisioned with K8s
  • Email vs Email with Priority
  • ...

Installation & Usage

npm install --save material-ui-mix-icon
Class React Component
import React, { Component } from 'react';
...
import ComposedIcon from 'material-ui-mix-icon';

class ExampleComponent extends Component {
    render() {
        return (
            <React.Fragment>
            ...
                <ComposedIcon
                    position="bottom-end"
                    size="medium"
                    icon='keyboard'
                    extraIcon='key'/>
            ...
            </React.Fragment>
        );
    }
}
export default ExampleComponent;
Functional React Component
import React from 'react';
...
import ComposedIcon from 'material-ui-mix-icon';

const ExampleComponent = ({..., position, ...}) => (
    <React.Fragment>
        ...
            <ComposedIcon
                position={position}
                size="medium"
                icon='keyboard'
                extraIcon='key'/>
        ...
    </React.Fragment>
)
...
export default ExampleComponent;

Integration

The simple-embedded way (CDN reliant)

NOTE: Example based on the default project structure provided by facebook/create-react-app project

In public/index.html in the <head> section add:

<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css" />

eventually should look like this:

<meta
    name="description"
    content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
...
    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.12.0/css/all.css" /> --- add this line
...
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />

Configuration

Variables supported by the library and available knobs for customization. All enforced by PropTypes.

Required Properties
  • icon - Supporting a string or a non fa object type
  • extraIcon - Supporting a string or a non fa object type
Optional Properties

  • size - selection from Material UI standard values: small, medium or large. Default: small
  • color - inherited property from Material UI. Possible values: inherit, primary, secondary. Default: inherit
  • position - Placement of extra icon. Possible values: top-start, top-end, bottom-start, bottom-end. Default: bottom-end
  • disabled - Boolean to mark the disabled flag for the icon presentation. Default: false

Sample Usage

Simple usage in Material UI elements, as child element or startIcon or start/endAdornment:

Self contained component with example values:

<ComposedIcon
    position='bottom-end'
    color="primary"
    size="large"
    icon='server'
    extraIcon='dharmachakra'
/>

Embedded in a button

 <Button
    variant="contained"
    color="primary"
    size="small"
    startIcon={
        <ComposedIcon
            position={props.position}
            color="primary"
            size='small'
            icon='server'
            extraIcon='dharmachakra'
        />}
    >
    Sample
</Button>

Icon button usage:

<IconButton aria-label="sample-icon-button">
    <ComposedIcon
        position={props.position}
        size="large"
        icon='server'
        extraIcon='dharmachakra'
    />
</IconButton>

Fab button usage:

 <Fab disabled aria-label="like">
    <ComposedIcon
        position={props.position}
        size="large"
        disabled
        icon='server'
        extraIcon='dharmachakra'
    />
</Fab>

And also in a field with adornment

 <TextField
    id="input-with-icon-textfield"
    label="TextField"
    disabled
    defaultValue="disabled field"
    InputProps={{
    startAdornment: (
        <InputAdornment position="start">
        <ComposedIcon
            position={props.position}
            size="small"
            icon='server'
            extraIcon='dharmachakra'/>
        </InputAdornment>
    ),
    }}
/>