[**Documentation**](../../../../README)

***

[Documentation](../../../../README) / [@zerotal/admin](../../README) / [index](../README) / applyLayout

# Function: applyLayout()

> **applyLayout**\<`T`\>(`widgets`, `keyOf`, `layout`): `object`

Defined in: [admin/src/dashboardLayout.ts:53](https://github.com/zerotaldev/zerotal/blob/1d6fb26b05b18ba077de1bfaeb46c42131cd8b70/packages/admin/src/dashboardLayout.ts#L53)

Apply a layout to the widgets a panel declares.

The declaration is the source of truth for *which* widgets exist; the layout
only says how to arrange them. So a widget added since the layout was saved
still appears (at the end, where it is noticeable rather than lost), and a
widget since removed does not resurrect because a stale key mentions it.

## Type Parameters

### T

`T`

## Parameters

### widgets

`T`[]

### keyOf

(`widget`, `index`) => `string`

### layout

[`DashboardLayout`](../interfaces/DashboardLayout) \| `null`

## Returns

`object`

### visible

> **visible**: `T`[]

### hidden

> **hidden**: `object`[]
