Skip to content
format
AutoXXS (320px)XS (375px)SM (640px)MD (768px)LG (1024px)XL (1280px)XXL (1536px)
SketchMaterialiOSTamagui
DataInjectionKeyPatternsServiceTransactionProcessResearchProductQualityPerformanceSpecDomainFunctionTechnologyArchitectureConfigMiddlewareDataDatabaseDrizzleMigrationModelop-sqliteSchemaSQLState ManagementDraftKeystoneMergePatchPatchesPersistenceReactiveRedoStoreUndoTestingDeviceFactoryIsolationTypeScriptZodTopicsCommunicationBidsNVCDesignDesign ImplicationsEducationPedagogyFoundationsPsychologyAttachmentFloodingRelatingAuthentic RelatingUIEditorReact Native

format

Fragment reference format
tags
ui

Three formatting components backed by browser-native Intl APIs β€” no language packs required.

  • format-number β€” decimals, percentages, currencies via Intl.NumberFormat
  • format-date β€” dates, times, weekdays via Intl.DateTimeFormat
  • format-bytes β€” byte/bit sizes with configurable verbosity

Attributes β€” format-number

NameTypeDefaultDescription
valuenumber0Number to format.
typedecimal | currency | percentdecimalFormatting style.
currencystringUSDISO 4217 currency code. Used when type="currency".
currency-displaysymbol | narrowSymbol | code | namesymbolHow to display the currency.
minimum-fraction-digitsnumber-Minimum decimal places (0–100).
maximum-fraction-digitsnumber-Maximum decimal places (0–100).
without-groupingbooleanfalseDisables thousands separator.
langstringbrowser defaultBCP 47 locale tag (e.g. en-US, de).

Attributes β€” format-date

NameTypeDefaultDescription
datestring | Datenew Date()ISO 8601 date string to format.
weekdaynarrow | short | long-Display format for the weekday.
yearnumeric | 2-digit-Display format for the year.
monthnumeric | 2-digit | narrow | short | long-Display format for the month.
daynumeric | 2-digit-Display format for the day.
hournumeric | 2-digit-Display format for the hour.
minutenumeric | 2-digit-Display format for the minute.
secondnumeric | 2-digit-Display format for the second.
hour-formatauto | 12 | 24auto12- or 24-hour clock.
time-zonestring-IANA time zone name (e.g. America/New_York).
langstringbrowser defaultBCP 47 locale tag (e.g. en-US, fr).

Attributes β€” format-bytes

NameTypeDefaultDescription
valuenumber0Value to format.
unitbyte | bitbyteDisplay as bytes or bits.
displaylong | short | narrowshortLabel verbosity: β€œ100 bytes”, β€œ100 B”, β€œ100B”.
langstringbrowser defaultBCP 47 locale tag for number formatting.

Always use ISO 8601 for dates. Avoid 03/04/2026 β€” browsers may interpret month/day order differently.

Numeric formatting with decimal, percent, and currency
puguiformat wa-format-number
format-number(value=12345.67)
format-number(value=0.753 type="percent")
format-number(value=2000 type="currency" currency="USD" lang="en-US")
Date formatting with long month, weekday, and time
puguiformat wa-format-date
format-date(date="2026-04-30T12:00:00Z" month="long" day="numeric" year="numeric")
format-date(date="2026-04-30T12:00:00Z" weekday="long")
format-date(date="2026-04-30T14:30:00Z" hour="numeric" minute="numeric" hour-format="12")
Byte size formatting with display verbosity variants
puguiformat wa-format-bytes
format-bytes(value=512)
format-bytes(value=1572864 display="long")
format-bytes(value=1572864 display="short")
format-bytes(value=1572864 display="narrow")