# Format Bytes

> Source: https://design.nanatec.co.ke/components/format-bytes/
> Formats a byte (or bit) value into a human-readable, locale-aware string, auto-scaling to the best unit (B → kB → MB → GB …).

Formats a byte (or bit) value into a human-readable, locale-aware string, auto-scaling to the best unit (B → kB → MB → GB …).

## Preview

```html
<nana-format-bytes value="1048576"></nana-format-bytes>
```

## Installation

```bash
npm install @nana-tec/ui-components
```

## Import

```js
import "@nana-tec/ui-components/format-bytes";
```

## Basic usage

```html
<nana-format-bytes value="1048576"></nana-format-bytes>
```

## Examples

```html
<nana-format-bytes value="1024"></nana-format-bytes>
<nana-format-bytes value="1048576"></nana-format-bytes>
<nana-format-bytes value="1500000" unit="bit"></nana-format-bytes>
```

## API

## Related components

<ul class="related not-content">
  <li><a href="/components/format-number/">Format Number</a></li>
  <li><a href="/components/format-date/">Format Date</a></li>
  <li><a href="/components/relative-time/">Relative Time</a></li>
</ul>

## Storybook

See every state and prop interactively in Storybook: https://storybook.nanatec.co.ke/?path=/docs/components-format-bytes--docs
