2.7.2 • Published 3 years ago

@tdcerhverv/icon v2.7.2

Weekly downloads
442
License
Apache-2.0
Repository
github
Last release
3 years ago

Icon component

The icon component is a simple wrapper component that takes an SVG react component and handles sizes, classes and click handlers.
It doesn't render anything by itself but it applies properties to the supplied SVG component.

Usage

Import like this:

import { Icon } from '@tdcerhverv/icon';

You will also need an actual icon, eg.

import Success from '@tdcerhverv/parrotfish/dist/icons/Icons/Success.svg';

Use like this:

<Icon icon={Success} size={16} />

Props

export interface IIcon extends SVGProps<SVGSVGElement> {
  icon: JSXElementConstructor<SVGProps<SVGSVGElement>>;
  size?: 8 | 12 | 16 | 20 | 24 | 28 | 32 | 40 | 48 | 56 | 64;
  inline?: boolean;
}

Notes:

size is optional and will default to 24.

inline is optional and will align the icon better when used as inline element.

All standard element properties (e.g. className, id, etc.) is supported, see the inherited properties here:
https://developer.mozilla.org/en-US/docs/Web/API/SVGSVGElement.

Sizes

SizeSpecificationEquivalent
80.5rem8px
120.75rem12px
161rem16px
201.25rem20px
24 (default)1.5rem24px
281.75rem28px
322rem32px
402.5rem40px
483rem48px
563.5rem56px
644rem64px

Up to size 32 has increments of 4 pixels and above size 32 has increments of 8 pixels.

Tags

icon