

### `formatPercentage` [#formatpercentage]

Converts decimal values (0-1) into percentage strings with null-safe handling and database string support. Ideal for confidence scores, accuracy metrics, and progress indicators.

```tsx
import { formatPercentage } from "@tilt-legal/cubitt-components/utilities/formatters";

formatPercentage(0.85); // "85%"
formatPercentage(0.856, { decimals: 1 }); // "85.6%"
formatPercentage(null); // "-"
formatPercentage("0.75"); // "75%"
```

| Property   | Type     | Default | Description                              |
| ---------- | -------- | ------- | ---------------------------------------- |
| `decimals` | `number` | `0`     | Number of decimal places                 |
| `fallback` | `string` | `"-"`   | String to return for null/invalid values |

#### Handling null values [#handling-null-values]

Gracefully handles null, undefined, and invalid inputs:

```tsx
formatPercentage(null); // "-"
formatPercentage(undefined); // "-"
formatPercentage(NaN); // "-"
formatPercentage("invalid"); // "-"
formatPercentage(null, { fallback: "N/A" }); // "N/A"
```

#### Database string support [#database-string-support]

Accepts string values directly from database queries:

```tsx
formatPercentage("0.85"); // "85%"
formatPercentage("0.9"); // "90%"
```
