$ cnpm install deku-material-svg-icons
Google's Material Design SVG icons as Deku components.
npm install --save deku-material-svg-icons
require('deku-material-svg-icons/lib/{category}/{icon-name}')
returns a single icon component. These {icon-name}
s are "dasherised": hardware/keyboard-arrow-up
, not hardware/keyboard_arrow_up
.
/** @jsx element */
var deku = require('deku')
var element = require('virtual-element')
var WarningIcon = require('deku-material-svg-icons/lib/alert/warning')
var tree = deku.tree(
<WarningIcon color="#f00" />
// or without JSX:
// element(WarningIcon, { color: '#f00' })
)
deku.render(tree, document.getElementById('#warning-icon'))
Set the icon size. Defaults to 24 pixels. This can be any value accepted by the CSS width
and height
properties. If you pass a unitless value (size={32}
), pixels are assumed instead.
Set the icon color. Defaults to black (#000).
Add additional CSS styles. If you're using magic-virtual-element
, you can pass an object, too.
All other attributes are passed through to the underlying SVG element verbatim.
Run npm run build
to generates Deku components for all material design icons. Generated components go in lib/{category}/{icon-name}
.
Copyright 2014 - 2016 © taobao.org |