JSPM

@polkadot/react-identicon

0.62.2-23
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28663
  • Score
    100M100P100Q149426F
  • License Apache-2.0

Renders an SVG picture representing an address

Package Exports

  • @polkadot/react-identicon

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@polkadot/react-identicon) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@polkadot/react-identicon

A generic identity icon that can render icons based on the theme, be it Substrate or Polkadot

Usage Examples

To install the component, do yarn add @polkadot/react-identicon

Inside a React component, you can now render any account with the associated icon -

import Identicon from '@polkadot/react-identicon';

...
render () {
  // address is an ss58-encoded address or publicKey (hex string or Uint8Array)
  const { address } = this.props;
  // size (optional) is a number, indicating the size (in pixels, 64 as default)
  const size = 32;
  // theme (optional), depicts the type of icon, one of
  // 'polkadot', 'substrate' (default), 'beachball' or 'jdenticon'
  const theme = 'polkadot';

  // standard className & style props are also available
  return (
    <Identicon
      value={address}
      size={size}
      theme={theme}
    />
  );
}
...