Igloo branding

Metric

A metric component is a button that visually represents a specific metric or measurement. It provides a concise and interactive way for users to access important information or track key performance indicators.

Installation

To install @igloo-ui/metric in your project, you will need to run the following command using npm:

npm install @igloo-ui/metric

If you prefer Yarn, use the following command instead:

yarn add @igloo-ui/metric

Usage

Then to use the component in your code just import it!

import Metric from '@igloo-ui/metric';
import Wellness from '@igloo-ui/icons/dist/Wellness';

const [selected, setSelected] = React.useState(false);
const handleOnPress = () => {
  setSelected(!selected);
};

<Metric
  value={20}
  variation={3}
  label="Metric Name"
  icon={<Wellness size="medium" />}
  onPress={handleOnPress}
  appearance={selected ? 'selected' : 'positive'}
/>;

API

Metric

PropTypeDescription
appearanceAppearanceThe appearance of the metric
classNamestringAdd a specific class to the metric
dataTeststringAdd a data-test tag for automated tests
iconReactElement<any, string | JSXElementConstructor<any>>The icon to display
labelstringThe label or metric name to display
tooltipstringThe tooltip to display
typeMetricTypeThe type of metric
valuenumberThe value of the metric (Only variation is used for type fluctuate)
variationnumberThe variation of the metric

Score

PropTypeDescription
arrowSize"small" | "medium" | "large"The size of the arrow
classNamestringAdd a specific class to the metric
forceDecimalbooleanForce the score to have a decimal
hideIfZerobooleanWhether or not the score should be hidden if it is zero
isSelectedbooleanWhether or not the score should have a selected style
isVariationbooleanWhether or not the score is a variation
valuenumberThe value of the score