React DGX SVG Icons
npm install @nypl/dgx-svg-icons
SVG icons used at NYPL Digital as React Components.
Version 0.3.12
This project uses Styleguidist to generate a page with all the available icons and their properties here: https://nypl.github.io/dgx-svg-icons/
npm i --save @nypl/dgx-svg-icons
* npm install
* npm start
* Go to localhost:3000
All the icons are exported individually so you can choose which ones you want to import.
``javascript
import React from 'react';
import { render } from 'react-dom';
import {
LionLogoIcon,
BookIcon,
} from 'dgx-svg-icons';
render(
document.getElementById('LionLogoIcon')
);
`
* From the command line rebuild the /dist directory with npm run build.
* Optional but useful: rebuild the /docs styleguide with npm run styleguide:build.
* Add & commit the new /dist and /docs folders and make the pull request
with development as the base.
* Changes must be approved by a peer reviewer
* Merge changes upon approval
* Merge development into master
* Create a tag for use by npmjs.com$3
There are props that all components use:
prop | type
--- | ---
ariaHidden | boolean
className | string
height | string
iconId | string
preserveAspectRatio | string
svgRole | string
title | string
width | string
viewBox | string
By default, the
defaultProps generate:* viewBox
* title
* className
* preserveAspectRatio
* svgRole
There are also props such as
fill, style, and size for only a few components.$3
There are certain icons that will appear multiple times and have presentational value, but not necessarily semantic or have value with respect to accessibility, and others where there should only be one instance.In the case of multiple rendering of an icon, such as the three-dotted "more" icon a unique ID is not required and should not be set (unless your application requires it to be set), but it should have the
ariaHidden attribute set (if not already set by default in the icon.jsx file).Example:
`javascriptrender( );
`In the case where a unique id should be set for each instance and in the case of it appearing multiple times. The
iconId property will set id="{iconId}" on the svg's title attribute, this will also set aria-labelledby attribute on the