MDCIconButton component implemented by react component.
Parameters:
Name | Type | Description | ||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
props |
Object | Attributes other than followings are passed to the Properties
|
- Source:
Returns:
- Type
- DetailedReactHTMLElement
Example
import { IconButton } from 'material-react-js';
function MyFavoriteButton(props) {
switch (props.type) {
case 'material':
return <IconButton className="material-icons" icon="favorite"/>;
// The following code also returns the same output
// return <IconButton className="material-icons">favorite</IconButton>;
case 'image':
return <IconButton><img src="./img/favorite.png" alt="favorite"/></IconButton>;
case 'svg':
return (
<IconButton>
<svg viewBox="0 0 32 32">...</svg>
</IconButton>
);
default:
throw new Error('unknown icon type');
}
}