properties
changelog

Numbers Dataset

The Numbers dataset defines commonly used numeric values in multiple formats: plain numbers, fractions and percentages


Location

Resolved locations:

  • shilpConfig.values.numbers.DEFAULT
  • shilpConfig.values.numbers.fractions
  • shilpConfig.values.numbers.percentages

Theme locations:

  • shilpConfig.theme.numbers
  • shilpConfig.theme.numbers.fractions
  • shilpConfig.theme.numbers.percentages

Usage

IntentTheme KeyDescription
@adjust scale-*;"fractions"Transform scale
@animate fade-*;"fractions"Fade in/out animation
@animate zoom-*;"fractions"Zoom in/out animation
@filter bright-*;"fractions"Brightness filter
@filter contrast-*;"fractions"Contrast filter
@filter gray-*;"fractions"Grayscale filter
@filter opacity-*;"fractions"Opacity filter
@filter saturate-*;"fractions"Saturation filter
@filter sepia-*;"fractions"Sepia filter
@filter backdrop-bright-*;"fractions"Brightness backdrop filter
@filter backdrop-contrast-*;"fractions"Contrast backdrop filter
@filter backdrop-gray-*;"fractions"Grayscale backdrop filter
@filter backdrop-opacity-*;"fractions"Opacity backdrop filter
@filter backdrop-saturate-*;"fractions"Saturation backdrop filter
@filter backdrop-sepia-*;"fractions"Sepia backdrop filter
@layout opacity-*;"fractions"Layout opacity
@svg fill-opacity-*;"fractions"SVG fill opacity
@svg stroke-opacity-*;"fractions"SVG stroke opacity

These utilities read values from the theme, which is built from this dataset.

Dataset Structure

The dataset is a nested key–value map of numeric tokens to CSS values.

It includes following groups:

  • DEFAULT → plain numeric values (0-200)
  • fractions → decimal values (0.0-2.0)
  • percentages → percentage values (0%-200%)

See: Numbers Dataset Reference

Customizing the Dataset

You can extend or override this dataset in your config.

Customize numbers dataset
/** @type {import('shilpcss/types').ShilpConfig} */
const shilpConfig = {
  source: "react",

  extend: {
    values: {
      numbers: {
        //
        DEFAULT: {
          250: 250,
        },
        //
        fractions: {
          250: 2.5,
        },
        //
        percentages: {
          250: "250%",
        },
      },
    },
  },
};

export default shilpConfig;

This will make additional numeric tokens available through the theme system.

Numbers Dataset Reference

Numbers Dataset
const numbers = {
  DEFAULT: {
    0: 0,
    5: 5,
    10: 10,
    20: 20,
    25: 25,
    30: 30,
    40: 40,
    50: 50,
    60: 60,
    70: 70,
    75: 75,
    80: 80,
    90: 90,
    95: 95,
    100: 100,
    DEFAULT: "100",
    105: 105,
    110: 110,
    125: 125,
    150: 150,
    175: 175,
    200: 200,
  },

  fractions: {
    0: 0,
    5: 0.05,
    10: 0.1,
    20: 0.2,
    25: 0.25,
    30: 0.3,
    40: 0.4,
    50: 0.5,
    60: 0.6,
    70: 0.7,
    75: 0.75,
    80: 0.8,
    90: 0.9,
    95: 0.95,
    100: 1,
    DEFAULT: "1",
    105: 1.05,
    110: 1.1,
    125: 1.25,
    150: 1.5,
    175: 1.75,
    200: 2,
  },

  percentages: {
    0: "0%",
    5: "5%",
    10: "10%",
    20: "20%",
    25: "25%",
    30: "30%",
    40: "40%",
    50: "50%",
    60: "60%",
    70: "70%",
    75: "75%",
    80: "80%",
    90: "90%",
    95: "95%",
    100: "100%",
    DEFAULT: "100%",
    105: "105%",
    110: "110%",
    125: "125%",
    150: "150%",
    175: "175%",
    200: "200%",
  },
};

export default numbers;

Published at:

Last updated at: