Search documentation of phoenix_kit

# PhoenixKitWeb.Components.Core.FileDisplay (phoenix_kit v1.6.19)

View Source

Components for displaying file-related information.

Provides status badges, file size formatting, and modification time display.

# Summary

## Functions

file_mtime(assigns)

Displays formatted modification time (relative or absolute).

file_size(assigns)

Displays formatted file size with automatic unit conversion.

page_status_badge(assigns)

Displays a status badge for pages.

# Functions

# file_mtime(assigns)

Displays formatted modification time (relative or absolute).

## Examples

    <.file_mtime mtime={~N[2025-01-15 10:00:00]} />

## Attributes

- `mtime` (`:any`) (required)
- `class` (`:string`) - Defaults to `""`.

# file_size(assigns)

Displays formatted file size with automatic unit conversion.

Handles nil values by returning "Unknown". Converts to GB, MB, KB, or bytes based on size.

## Examples

    <.file_size bytes={1024} />  <%!-- 1.0 KB --%>
    <.file_size bytes={1_048_576} />  <%!-- 1.0 MB --%>
    <.file_size bytes={5_242_880} />  <%!-- 5.0 MB --%>
    <.file_size bytes={nil} />  <%!-- Unknown --%>

## Attributes

- `bytes` (`:integer`) - Defaults to `nil`.
- `class` (`:string`) - Defaults to `""`.

# page_status_badge(assigns)

Displays a status badge for pages.

## Examples

    <.page_status_badge status="published" />
    <.page_status_badge status="draft" />
    <.page_status_badge status="archived" />

## Attributes

- `status` (`:string`) (required)
- `class` (`:string`) - Defaults to `""`.