BridgeBeta
  • Brand
  • Digital Assets
    Foundations
    Icons
    Components
    Templates
  • Resources
    Design Tokens
    How-tos
    Best Practices
    Libraries
    Accessibility
    Products List
  • Support
    • Overview
    • Actions
      • Overview
      • Button
      • ContextMenu
      • Link
    • Controls
      • Overview
      • Checkbox
      • Tag
      • Toggle
    • Forms
      • Overview
      • DatePicker
      • FileUploader
      • Input
      • NumberInput
      • RadioButton
      • Search
      • Select
      • Slider
      • TextArea
      • TextInput
    • Hooks
      • useIsomorphicLayoutEffect
      • useMediaQuery
      • useSettings
    • Navigation
      • Overview
      • AnchorNavigation
      • BannerNavigation
      • Breadcrumb
      • Footer
      • InfoBar
      • MainNavigation
      • SecondaryNavigation
      • StepNavigation
      • SubNavigation
    • Overlay
      • Overview
      • Credits
      • Modal
      • ModalWrapper
      • Notification
      • Tooltip
    • Structure
      • Overview
      • Accordion
      • AuthLayout
      • Avatar
      • Callout
      • Card
      • ContentSwitcher
      • Empty
      • Hero
      • InlineLoading
      • Item
      • List
      • Loading
      • mdxComponents
      • Module
      • Pagination
      • ReadMore
      • Story
      • Table
      • Tabs
      • Text
      • Unit
      • User
      • WFPCoreProvider
      • Wrapper
Components
Structure
Unit
Documentation up to date

Unit

  • Design
  • Code
  • Props

Unit

Expand code

Editable Example

import { Unit } from "@wfp/react";

() => {
  const action = () => {};
  return (
    <Unit
      maximumFractionDigits={3}
      minimumFractionDigits={3}
      type="num"
    >
      123456.12
    </Unit>
  );
};

PropDefaultDescriptionValue

children

ReactNode
–

The value which should be displayed

from

string |number
–

Only used for type Percentage will divide value/from string, float

input

"thousand" |"million" |"billion" |"auto"
–

The interface of the input value

hideEmpty

boolean
–

Hide the Unit if it's value is zero.

minimumFractionDigits

number
–

The minimum number of fraction digits to use. Possible values are from 0 to 20. Only used on numeric types

maximumFractionDigits

number
–

The maximum number of fraction digits to use. Possible values are from 0 to 20. Only used on numeric types

maximumSignificantDigits

number
–

A value between 1-21, The maximum number of significant digits to use. Possible values are from 1 to 21; the default is minimumSignificantDigits.

enableUnitOutputInStringType

boolean
–

Formats the Unit output into a single-line string

localeStringLanguage

string
–

A string with a BCP 47 language code, or an array of language codes. For the general form and interpretation of the locale argument see the toLocaleString on developer.mozilla.org page.

svg

boolean
–

Render output as svg text

type

"none" |"usd" |"partners" |"beneficiaries" |"households" |"months" |"mt" |"metricTons" |"kg" |"num" |"yearMonth" |"level" |"people" |"countries" |"percentage"
–

The unit type

On this page

  • Unit

References

  • Storybook
Storybook
Figma library
Contact us
2025 © World Food Programme