{
  "tag": "ed-format-bytes",
  "kind": "component",
  "summary": "Formats a number as a human readable bytes value.",
  "status": "experimental",
  "level": "atom",
  "since": "1.0",
  "docs": "https://test-apps.eurodata.de/a/eurodata-ui/docs/components/format-bytes/",
  "usage": "https://test-apps.eurodata.de/a/eurodata-ui/docs/components/format-bytes/usage/",
  "playwright": "getByTestId('…')",
  "dependencies": [],
  "use": [
    "Wherever a byte count meets the user — upload and attachment lists, download sizes, storage quotas, size columns in tables",
    "Showing the size next to each attachment in a document list, so users see how large a file is before opening it",
    "A size column in a table of uploaded documents, readable without counting digits"
  ],
  "notFor": [
    {
      "when": "A value whose exact byte count matters — it rounds to three significant digits",
      "instead": "the precise value with [Format Number](https://test-apps.eurodata.de/a/eurodata-ui/docs/components/format-number)"
    },
    {
      "when": "Plain numbers, amounts, or percentages",
      "instead": "[Format Number](https://test-apps.eurodata.de/a/eurodata-ui/docs/components/format-number)"
    }
  ],
  "rules": [
    {
      "id": "format-bytes/raw-byte-count",
      "rule": "Never assemble a file-size string by hand or divide by 1024 — pass the raw byte count straight from the API and let the component pick the unit and rounding.",
      "why": "A hand-built \"12,5 MB\" hardcodes one locale's separators, one rounding rule, and one unit convention. The component uses decimal units and localized separators and formats a size the same way everywhere in the product; a second convention next to it drifts apart.",
      "check": "warning"
    },
    {
      "id": "format-bytes/byte-unit",
      "rule": "Keep the default byte unit, and switch to bit only where the domain genuinely speaks in bits, such as network throughput. Never mix bytes and bits within one view.",
      "check": "error"
    },
    {
      "id": "format-bytes/one-display-per-view",
      "rule": "Keep one display form per view, so sizes stay comparable.",
      "why": "Mixing \"MB\" and \"megabytes\" in one list reads as noise.",
      "check": "error"
    }
  ],
  "api": {
    "attributes": [
      {
        "name": "value",
        "property": "value",
        "type": "number",
        "default": "0",
        "description": "The number to format in bytes. A value that is not a finite number renders nothing."
      },
      {
        "name": "unit",
        "property": "unit",
        "type": "'byte' | 'bit'",
        "default": "'byte'",
        "description": "The type of unit to display."
      },
      {
        "name": "display",
        "property": "display",
        "type": "'short' | 'long' | 'narrow'",
        "default": "'short'",
        "description": "Determines how to display the result, e.g. \"100 bytes\", \"100 b\", or \"100b\"."
      },
      {
        "name": "dir",
        "property": "dir",
        "type": "string"
      },
      {
        "name": "lang",
        "property": "lang",
        "type": "string"
      }
    ],
    "properties": [],
    "methods": [
      {
        "name": "getPropertyDescriptor",
        "static": true,
        "parameters": [
          {
            "name": "name",
            "type": "PropertyKey"
          },
          {
            "name": "key",
            "type": "string | symbol"
          },
          {
            "name": "options",
            "type": "PropertyDeclaration"
          }
        ],
        "returns": "PropertyDescriptor | undefined",
        "description": "Wraps the accessor of reflected properties so they always hold a valid value, as a native\nreflected IDL attribute does (`button.type = undefined` reads `submit`):\n\n- A property that declares `useDefault` takes the first value set on an element for its\n  default. That value is its field initializer's: the constructor has finished before markup,\n  a framework or any other code can set anything. Every later `null` or `undefined` means what\n  a dropped prop means on a native element — the attribute is removed: with the attribute\n  there, it is removed and Lit's `useDefault` restores the default without writing it; without\n  one, the property is set to the default. A value set and cleared again before the element\n  updates still writes the default once, from the pending reflection.\n- A Boolean is coerced with `Boolean()`, so `undefined` is `false`.\n\nLit's `useDefault` keeps the initial default out of the DOM. Setting the default explicitly\nwrites it, as `button.type = 'submit'` writes `type`."
      }
    ],
    "events": [],
    "slots": [],
    "cssProperties": [],
    "parts": [],
    "states": []
  },
  "import": "import '@eurodata/eurodata-ui/dist/components/format-bytes/format-bytes.js';",
  "react": {
    "component": "EdFormatBytes",
    "import": "import EdFormatBytes from '@eurodata/eurodata-ui/dist/react/format-bytes/index.js';"
  }
}
