MCPcopy Create free account
hub / github.com/adobe/react-spectrum / FormattedNumber

Function FormattedNumber

packages/@react-spectrum/s2/src/LabeledValue.tsx:274–286  ·  view source on GitHub ↗
({
  value,
  formatOptions
}: {
  value: NumberValue;
  formatOptions?: Intl.NumberFormatOptions;
})

Source from the content-addressed store, hash-verified

272}
273
274function FormattedNumber({
275 value,
276 formatOptions
277}: {
278 value: NumberValue;
279 formatOptions?: Intl.NumberFormatOptions;
280}) {
281 let formatter = useNumberFormatter(formatOptions);
282 if (typeof value === 'object') {
283 return <>{formatter.formatRange(value.start, value.end)}</>;
284 }
285 return <>{formatter.format(value)}</>;
286}
287
288function FormattedDate<T extends DateTimeValue>({
289 value,

Callers

nothing calls this directly

Calls 3

useNumberFormatterFunction · 0.90
formatRangeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected