# Format Bytes
[component-header:sl-format-bytes]
```html preview
The file is in size.
```
```jsx react
import { useState } from 'react';
import { SlButton, SlFormatBytes, SlInput } from '@shoelace-style/shoelace/dist/react';
const App = () => {
const [value, setValue] = useState(1000);
return (
<>
The file is in size.
setValue(event.target.value)}
/>
>
);
};
```
## Examples
### Formatting Bytes
Set the `value` attribute to a number to get the value in bytes.
```html preview
```
```jsx react
import { SlFormatBytes } from '@shoelace-style/shoelace/dist/react';
const App = () => (
<>
>
);
```
### Formatting Bits
To get the value in bits, set the `unit` attribute to `bit`.
```html preview
```
```jsx react
import { SlFormatBytes } from '@shoelace-style/shoelace/dist/react';
const App = () => (
<>
>
);
```
### Localization
Use the `lang` attribute to set the number formatting locale.
```html preview
```
```jsx react
import { SlFormatBytes } from '@shoelace-style/shoelace/dist/react';
const App = () => (
<>
>
);
```
[component-metadata:sl-format-bytes]