+++
# -----------------------------------------------------------------------
# Do not edit this file. It is automatically generated by API Documenter.
# -----------------------------------------------------------------------
title = "calculateFontSize"
keywords = ["grafana","documentation","sdk","@grafana/ui"]
type = "docs"
+++

## calculateFontSize() function

### calculateFontSize() function

<b>Signature</b>

```typescript
export declare function calculateFontSize(text: string, width: number, height: number, lineHeight: number, maxSize?: number): number;
```
<b>Import</b>

```typescript
import { calculateFontSize } from '@grafana/ui';
```
<b>Parameters</b>

|  Parameter | Type | Description |
|  --- | --- | --- |
|  text | <code>string</code> |  |
|  width | <code>number</code> |  |
|  height | <code>number</code> |  |
|  lineHeight | <code>number</code> |  |
|  maxSize | <code>number</code> |  |

<b>Returns:</b>

`number`

