# @salmonui/layout/dashboard-layout API reference

> 7 exported symbols of @salmonui/layout/dashboard-layout: 2 functions, 3 interfaces and 2 types.

Canonical: https://salmonui.dev/docs/reference/layout/dashboard-layout

```ts
import { … } from '@salmonui/layout/dashboard-layout';
```

## Functions

### DashboardLayout

Kind: function

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayout

```ts
function DashboardLayout(props: DashboardLayoutProps): ReactElement;

namespace DashboardLayout {
    export { DashboardLayoutPanel as Panel };
}
```

DashboardLayout (`.salmon-dashboard`).

### DashboardLayoutPanel

Kind: function

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayoutPanel

```ts
function DashboardLayoutPanel(_props: DashboardLayoutPanelProps): ReactElement | null;
```

`DashboardLayout.Panel`: a descriptor read by its `DashboardLayout` (it renders through the layout).

## Interfaces

### DashboardLayoutLocaleText

Kind: interface

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayoutLocaleText

```ts
interface DashboardLayoutLocaleText {
    readonly panel?: string | undefined;
    readonly instructions?: string | undefined;
    readonly grabbed?: string | undefined;
    readonly moved?: string | undefined;
    readonly resized?: string | undefined;
    readonly dropped?: string | undefined;
    readonly cancelled?: string | undefined;
}
```

Announcement templates: `{label}`, `{row}`, `{column}`, `{width}` and `{height}` are replaced.

Members (7):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `panel` | `readonly panel?: string \| undefined;` | optional | `aria-roledescription` of a panel. Default `"panel"`. |
| `instructions` | `readonly instructions?: string \| undefined;` | optional |  |
| `grabbed` | `readonly grabbed?: string \| undefined;` | optional |  |
| `moved` | `readonly moved?: string \| undefined;` | optional |  |
| `resized` | `readonly resized?: string \| undefined;` | optional |  |
| `dropped` | `readonly dropped?: string \| undefined;` | optional |  |
| `cancelled` | `readonly cancelled?: string \| undefined;` | optional |  |

### DashboardLayoutPanelProps

Kind: interface

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayoutPanelProps

```ts
interface DashboardLayoutPanelProps extends Omit<HTMLAttributes<HTMLDivElement>, 'id' | 'children'> {
    readonly id: string;
    readonly header?: ReactNode;
    readonly children?: ReactNode;
}
```

Members (3):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `readonly id: string;` |  | Stable panel id: the `id` of its layout item. |
| `header` | `readonly header?: ReactNode;` | optional | Header content; it names the panel for assistive technology. |
| `children` | `readonly children?: ReactNode;` | optional |  |

### DashboardLayoutProps

Kind: interface

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayoutProps

```ts
interface DashboardLayoutProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children' | 'onChange'> {
    readonly children?: ReactNode;
    readonly columns?: number | undefined;
    readonly gap?: number | readonly [
        number,
        number
    ] | undefined;
    readonly rowHeight?: number | undefined;
    readonly cellAspectRatio?: number | undefined;
    readonly showGridLines?: boolean | undefined;
    readonly layout?: readonly DashboardLayoutItem[] | undefined;
    readonly defaultLayout?: readonly DashboardLayoutItem[] | undefined;
    readonly onLayoutChange?: ((layout: DashboardLayoutItem[]) => void) | undefined;
    readonly draggable?: boolean | undefined;
    readonly dragHandle?: string | undefined;
    readonly resizable?: boolean | readonly DashboardResizeEdge[] | undefined;
    readonly compact?: GridCompact | undefined;
    readonly responsive?: {
        readonly stackBelow?: number | undefined;
    } | undefined;
    readonly localeText?: DashboardLayoutLocaleText | undefined;
    readonly ref?: Ref<HTMLDivElement> | undefined;
}
```

Members (16):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `children` | `readonly children?: ReactNode;` | optional | `DashboardLayout.Panel` children. |
| `columns` | `readonly columns?: number \| undefined;` | optional | Column count. Default 12. |
| `gap` | `readonly gap?: number \| readonly [     number,     number ] \| undefined;` | optional | Space between cells in px: one value, or `[inline, block]`. Default 8. |
| `rowHeight` | `readonly rowHeight?: number \| undefined;` | optional | Row height in px. Without it rows follow `cellAspectRatio`. |
| `cellAspectRatio` | `readonly cellAspectRatio?: number \| undefined;` | optional | Cell width / height when `rowHeight` is not set. Default 1 (square cells). |
| `showGridLines` | `readonly showGridLines?: boolean \| undefined;` | optional |  |
| `layout` | `readonly layout?: readonly DashboardLayoutItem[] \| undefined;` | optional | Controlled layout (the serialized form). |
| `defaultLayout` | `readonly defaultLayout?: readonly DashboardLayoutItem[] \| undefined;` | optional |  |
| `onLayoutChange` | `readonly onLayoutChange?: ((layout: DashboardLayoutItem[]) => void) \| undefined;` | optional | Once per committed drag, resize or keyboard drop, with every panel's item. |
| `draggable` | `readonly draggable?: boolean \| undefined;` | optional | Panels move with the pointer and the keyboard. Default true. |
| `dragHandle` | `readonly dragHandle?: string \| undefined;` | optional | CSS selector of the drag handle inside a panel; default the whole panel. |
| `resizable` | `readonly resizable?: boolean \| readonly DashboardResizeEdge[] \| undefined;` | optional | Resize handles: true is `['bottom-end']`. Default false. |
| `compact` | `readonly compact?: GridCompact \| undefined;` | optional | `'vertical'` floats panels up into free space. Default `'vertical'`. |
| `responsive` | `readonly responsive?: {     readonly stackBelow?: number \| undefined; } \| undefined;` | optional | `stackBelow`: below this container width (px, at least 100) panels stack in one column in layout order. |
| `localeText` | `readonly localeText?: DashboardLayoutLocaleText \| undefined;` | optional |  |
| `ref` | `readonly ref?: Ref<HTMLDivElement> \| undefined;` | optional | The root element. |

## Types

### DashboardLayoutItem

Kind: type

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardLayoutItem

```ts
type DashboardLayoutItem = GridLayoutItem;
```

One panel of the layout value, which is also its serialized form.

Members (10):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `id` | `id: string;` | inherited | Stable id (the `DashboardLayout.Panel` id). |
| `x` | `x: number;` | inherited | Column from the inline start, 0-based. |
| `y` | `y: number;` | inherited | Row from the top, 0-based. |
| `w` | `w: number;` | inherited | Width in columns. |
| `h` | `h: number;` | inherited | Height in rows. |
| `minW` | `minW?: number;` | optional, inherited |  |
| `maxW` | `maxW?: number;` | optional, inherited |  |
| `minH` | `minH?: number;` | optional, inherited |  |
| `maxH` | `maxH?: number;` | optional, inherited |  |
| `static` | `static?: boolean;` | optional, inherited | Never moved or resized, by the user or by other items. |

### DashboardResizeEdge

Kind: type

Page: https://salmonui.dev/docs/reference/layout/dashboard-layout/DashboardResizeEdge

```ts
type DashboardResizeEdge = 'top' | 'bottom' | 'start' | 'end' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
```

A resize handle: an edge or a corner, logical in the inline axis (`start` is the left in LTR, the right in RTL).
