Search documentation of phoenix_kit

# PhoenixKitWeb.Components.Core.NumberFormatter (phoenix_kit v1.7.87)

Copy Markdown View Source

Number formatting components for PhoenixKit.

Provides components for displaying numbers with proper formatting including thousand separators, abbreviations, and custom formatting options.

## Summary

### Functions

formatted_number(assigns)

Displays a formatted number with thousand separators.

## Functions

# formatted_number(assigns)

Displays a formatted number with thousand separators.

## Attributes

- `number` - The number to format (required, integer or any)
- `format` - Format style (default: :grouped)
  - `:grouped` - Add comma separators (1,234,567)
  - `:short` - Abbreviate large numbers (1.2M, 3.5K)
- `class` - Additional CSS classes

## Examples

    <.formatted_number number={1234567} />
    # Renders: 1,234,567

    <.formatted_number number={1234567} format={:short} />
    # Renders: 1.2M

    <.formatted_number number={0} />
    # Renders: 0

## Attributes

- `number` (`:any`) (required)
- `format` (`:atom`) - Defaults to `:grouped`. Must be one of `:grouped`, or `:short`.
- `class` (`:string`) - Defaults to `""`.