Format Bytes
Human-readable byte formatting with binary/decimal units and display styles.
<rhx-format-bytes>
Examples
Short (Default)
0 B
512 B
1 KB
1.5 MB
1 GB
1 TB
<rhx-format-bytes rhx-value="0" />
<rhx-format-bytes rhx-value="512" />
<rhx-format-bytes rhx-value="1024" />
<rhx-format-bytes rhx-value="1572864" />
<rhx-format-bytes rhx-value="1073741824" />
<rhx-format-bytes rhx-value="1099511627776" />
Long
1 byte
0 bytes
1.5 megabytes
<rhx-format-bytes rhx-value="1" rhx-display="long" />
<rhx-format-bytes rhx-value="0" rhx-display="long" />
<rhx-format-bytes rhx-value="1572864" rhx-display="long" />
Narrow
1KB
1.5MB
<rhx-format-bytes rhx-value="1024" rhx-display="narrow" />
<rhx-format-bytes rhx-value="1572864" rhx-display="narrow" />
Bits
500 b
1 kb
1 Mb
<rhx-format-bytes rhx-value="500" rhx-unit="bit" />
<rhx-format-bytes rhx-value="1000" rhx-unit="bit" />
<rhx-format-bytes rhx-value="1000000" rhx-unit="bit" />
Properties
| Property | Type | Default | Description |
|---|---|---|---|
rhx-value |
long |
0 |
The byte value to format |
rhx-display |
string |
short |
Display style: short, long, narrow |
rhx-unit |
string |
byte |
Unit type: byte (binary 1024) or bit (decimal 1000) |
Accessibility
- Renders as inline text content — screen readers read the formatted value naturally.
- No interactive elements or ARIA attributes required.