Icon

July 22, 2021 ยท View on GitHub

Displays an icon (image or SVG).

Main features

  • Set SVG or image
  • Set size
  • Create round avatar portrait image

Usage

Options

Icon options

ParameterRequiredTypeDefaultDescription
svgeither src or svg must be passedObjectSVG options object
srceither src or svg must be passedStringIcon image; creates an img element
sizeoptionalString"regular"Sets the size: either "small" (16px), "regular" (24px), "medium" (32px), "large" (40px). Adds CSS class pe-icon--small, etcetera
avataroptionalBooleanSet to true to add class pe-icon--avatar which creates a round portrait image

Common component options

ParameterRequiredTypeDefaultDescription
afteroptionalString, hyperscript or componentExtra content after main content; this content is placed right of preceding elements with a higher stacking depth
beforeoptionalString, hyperscript or componentExtra content before main content; this content is placed left of subsequent elements with a lower stacking depth
classNameoptionalStringExtra CSS class appended to pe-icon
contentoptionalString, hyperscript or componentAny content; replaces children and ignores svg
elementoptionalString"div"HTML element tag
idoptionalStringHTML element id
styleoptionalObjectFor setting simple style attributes
toneoptionalString: "dark" or "light"Renders the component light on dark (sets class pe-dark-tone); use "light" to locally inverse (sets class pe-light-tone)

Composition

Icon is composed from:

  • SVG (when using option svg)

CSS classes