Pass the size in bytes. Put a FileSizeEmpty inside for a file whose size is not known yet.
attachments.tsx
FileSize
<data>| Prop | Type | Default | Description |
|---|---|---|---|
| bytes | number | null | — | The size in bytes. null, undefined, NaN, and a negative size show the empty text. |
| total | number | null | — | The whole, for "used of total": storage, a quota, an upload. "1.2 of 4.8 GB" when both round to one unit, else "12 MB of 2 GB". null (an unknown or unlimited total) shows the used size alone. |
| base | 10001024 | — | The step: 1000 (default, SI: kB, MB, GB) or 1024 (IEC: KiB, MiB, GiB), for RAM and Windows. |
| length | "long""short" | "short" | The unit words: short (default, "1.8 MB") or long ("1.8 megabytes"). |
| tooltip | boolean | false | A Tooltip with the exact bytes ("2,401,872 bytes") on hover, focus, and tap, a dotted underline, and one tab stop. Default false: the short text. |
| locale | string | — | The BCP 47 locale. Default: the DisplayLocaleProvider locale, else "en-US". |
| labels | Partial<{ of: string; }> | — | The words (FILE_SIZE_LABELS). Keep the object stable. |
| children | ReactNode | — | A FileSizeEmpty part: the words of no value. With a value, they are not drawn. |
| ...props | <data> attributes | — | Every other attribute goes to the <data>, with a ref. |
FileSizeEmpty
<div>| Prop | Type | Default | Description |
|---|---|---|---|
| data-slot | string | — | The data-slot of the root: the item's own slot ("time-ago"). Default "empty-value". |
From Base UIUseRenderBase UI docs | |||
| render | — | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a ReactElement or a function that returns the element to render. | |
| ...props | <div> attributes | — | Every other attribute goes to the <div>, with a ref. |
| Tab | With tooltip, moves to the size and shows the exact bytes in a Tooltip. |
|---|
Built with
Installs with File Size
- Components
- Full Value





