<!-- GENERATED by scripts/build-llms.mjs from llms/utility.md — do not edit this file. -->

# `lr-format-bytes`

- **Import** `import '@aceshooting/lyra-ui/components/lr-format-bytes.js';` (stable tag alias; registers the tag)
- **Class** `LyraFormatBytes`, also available unregistered from `@aceshooting/lyra-ui/components/utility/format/format-bytes.class.js`
- **Family** `components/utility/` — see `llms/index.md` for its siblings
- **Status** `stable` since `4.0.0` — see the maturity and deprecation policy in `llms/shared.md`
- **Release history** [CHANGELOG.md](../../CHANGELOG.md); family-wide breaking-change summaries: [llms-full.txt](../../llms-full.txt)
- **Deprecations** none
- **Optional peers** none
- **Themeable via** nothing component-specific — inherits only the shared surface
- **Library-wide behavior** (events, form association, `locale`/`strings`, tokens, TS types): `llms/shared.md`

---

## `lr-format-bytes`

Byte/bit output via `Intl.NumberFormat`'s `style: 'unit'`, so the unit name is localized too.
Text-only host — no CSS parts, events, or own tokens; locale resolution and
`Intl`-instance caching are as described under `lr-format-number` above.

**Properties:**

- `value: number = 0`
- `unit: 'byte' | 'bit' = 'byte'`
- `display: 'long' | 'short' | 'narrow' = 'short'` — forwarded as `unitDisplay`
- `unitStep: number = 1000` (attribute `unit-step`) — mapped decimal scaling. **Changed in 8.0.0:**
  the former Lyra default was `1024`; it remains an opt-in extension
- `decimals: number = 1` — maximum fraction digits on the scaled amount

**Slots:** default — fallback content, rendered only when `value` is not finite.

The selected ladder is `byte`/`kilobyte`… or `bit`/`kilobit`… through peta and saturates at the
top; the index is `floor(log|value| / log(unitStep))`, and zero stays in the base unit. Magnitudes
below one remain at index zero. `unitStep` is normalized to a finite number `> 1`, falling back to
`1000`; `decimals` clamps to `[0, 10]`. Setting `unitStep="1024"` still prints SI-named `kB`/`MB`
units, not `KiB`/`MiB`, because `Intl` exposes no binary unit names.
