<!-- # hard line break macro for HTML -->

# @fiftyone/spaces

## Hooks

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-useinitializepanel"></a>

### useInitializePanel

### @fiftyone/spaces.useInitializePanel()

### @fiftyone/spaces.initializePanel()

* **Arguments:**
  * **args** (`[ panelId , scope , state , data ]`)
* **Return type:**
  `Promise < void >` `<` `void` `>`

Returns a function that will run the callback that was passed when
calling this hook. Useful for accessing Recoil state in response to
events.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanel"></a>

### usePanel

### @fiftyone/spaces.usePanel(name, predicate)

* **Arguments:**
  * **name** ([`SpaceNodeType`](#fiftyone-spaces.SpaceNodeType))
  * **predicate** (`( panel : SpacePanelRegistration )`)
* **Return type:**
  `plugins.fiftyone.spaces.SpacePanelRegistration`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelarearenderer"></a>

### usePanelAreaRenderer

### @fiftyone/spaces.usePanelAreaRenderer(areaId)

* **Arguments:**
  * **areaId** (`string`)
* **Return type:**
  `Object`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelcloseeffect"></a>

### usePanelCloseEffect

### @fiftyone/spaces.usePanelCloseEffect(panelId)

* **Arguments:**
  * **panelId** ()

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelcontext"></a>

### usePanelContext

### @fiftyone/spaces.usePanelContext()

* **Return type:**
  `plugins.fiftyone.spaces.PanelContextType`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelid"></a>

### usePanelId

### @fiftyone/spaces.usePanelId()

* **Return type:**
  `string`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelloading"></a>

### usePanelLoading

### @fiftyone/spaces.usePanelLoading(id)

* **Arguments:**
  * **id** (`string`)
* **Return type:**
  `[` `boolean` `,` `( loading : boolean ,  id : string )` `]`

Get and set loading state of a panel

Note: `id` is optional if hook is used within the component of a panel.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelstate"></a>

### usePanelState

### @fiftyone/spaces.usePanelState(defaultState, id, local, scope)

* **Arguments:**
  * **defaultState** (`T`)
  * **id** (`string`)
  * **local** (`boolean`)
  * **scope** (`string`)
* **Return type:**
  `[` `plugins.fiftyone.spaces.T` `,` `SetterOrUpdater < T >` `]`

Get and set state of a panel

Note: `id` is optional if hook is used within the component of a panel.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelstatebyidcallback"></a>

### usePanelStateByIdCallback

### @fiftyone/spaces.usePanelStateByIdCallback(callback, local, scope)

* **Arguments:**
  * **callback** (`( panelId : string ,  panelState : T ,  args :  )`)
  * **local** (`boolean`)
  * **scope** (`string`)

Get a callback function that can be used to update the panel state.

**Returns**

A callback function that can be used to update the panel state. The
callback is called with the panelId, panelState, and args.

Example:

```typescript
const resolvePanelState = (panelId, panelState, args) => {
  const [countInc] = args;
  // do something with the panelState
  const count = panelState.count + countInc;
  return { ...panelState, count };
};
const local = true; // true = local state, false = global state
const setPanelState = usePanelStateByIdCallback(resolvePanelState, local, scope);
const usePanelId = usePanelId();
const countInc = 10;
setPanelState("panelId", panelState, [countInc]);

      .. js:function:: panelStateByIdCallback


         :param args:
         :type args: [ panelId ,  ]
         :rtype: ``Promise < void >`` ``<`` ``void`` ``>``
```

Returns a function that will run the callback that was passed when
calling this hook. Useful for accessing Recoil state in response to
events.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelstatecallback"></a>

### usePanelStateCallback

### @fiftyone/spaces.usePanelStateCallback(callback, local, scope)

* **Arguments:**
  * **callback** (`( panelState : T )`)
  * **local** (`boolean`)
  * **scope** (`string`)

Can only be used within a panel component

> ### @fiftyone/spaces.panelStateCallback()

> * **Arguments:**
>   * **args** (`[ ]`)
> * **Return type:**
>   `Promise < void >` `<` `void` `>`

Returns a function that will run the callback that was passed when
calling this hook. Useful for accessing Recoil state in response to
events.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelstatelazy"></a>

### usePanelStateLazy

### @fiftyone/spaces.usePanelStateLazy(local, scope)

* **Arguments:**
  * **local** (`boolean`)
  * **scope** (`string`)

Lazily read panel state on demand

**Returns**

a state resolver function which return promise that resolves to the
current state of a panel

> ### @fiftyone/spaces.panelStateLazy()

> * **Return type:**
>   `Promise < any >` `<` `any` `>`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelstatepartial"></a>

### usePanelStatePartial

### @fiftyone/spaces.usePanelStatePartial(key, defaultState, local, scope)

* **Arguments:**
  * **key** (`string`)
  * **defaultState** (`T`)
  * **local** (`boolean`)
  * **scope** (`string`)
* **Return type:**
  `Array<` `any` `>`

Get partial state of current panel (i.e. property of an object state)

Should only be used within a panel component whose state is an object or
: an array

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepaneltabautoposition"></a>

### usePanelTabAutoPosition

### @fiftyone/spaces.usePanelTabAutoPosition()

### @fiftyone/spaces.panelTabAutoPosition()

* **Arguments:**
  * **e** (`SortableEvent`)
* **Return type:**
  `Promise < void >` `<` `void` `>`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepaneltitle"></a>

### usePanelTitle

### @fiftyone/spaces.usePanelTitle(id)

* **Arguments:**
  * **id** (`string`)
* **Return type:**
  `readonly`

Get and set title of a panel

Note: `id` is optional if hook is used within the component of a panel.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanels"></a>

### usePanels

### @fiftyone/spaces.usePanels(predicate)

* **Arguments:**
  * **predicate** (`( panel : SpacePanelRegistration )`)
* **Return type:**
  `Array<` `plugins.fiftyone.spaces.SpacePanelRegistration` `>`

Hook to get all panels registered in the app, optionally filtered by a
predicate.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usepanelsstate"></a>

### usePanelsState

### @fiftyone/spaces.usePanelsState(local)

* **Arguments:**
  * **local** (`boolean`)
* **Return type:**
  `[` `plugins.fiftyone.spaces.PanelsStateObject` `,` `( newPanelsState : PanelsStateObject )` `]`

Get and set multiple panels session or local state

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usereactivepanel"></a>

### useReactivePanel

### @fiftyone/spaces.useReactivePanel(name)

* **Arguments:**
  * **name** ([`SpaceNodeType`](#fiftyone-spaces.SpaceNodeType))
* **Return type:**
  `plugins.fiftyone.spaces.SpacePanelRegistration`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usesetcustompanelstate"></a>

### useSetCustomPanelState

### @fiftyone/spaces.useSetCustomPanelState(local)

* **Arguments:**
  * **local** ()

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usesetpanelcloseeffect"></a>

### useSetPanelCloseEffect

### @fiftyone/spaces.useSetPanelCloseEffect(panelId)

* **Arguments:**
  * **panelId** ()

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usesetpanelstatebyid"></a>

### useSetPanelStateById

### @fiftyone/spaces.useSetPanelStateById(local, scope)

* **Arguments:**
  * **local** (`boolean`)
  * **scope** ()

Returns a function that will run the callback that was passed when
calling this hook. Useful for accessing Recoil state in response to
events.

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usespacenodes"></a>

### useSpaceNodes

### @fiftyone/spaces.useSpaceNodes(spaceId)

* **Arguments:**
  * **spaceId** (`string`)
* **Return type:**
  `Array<` `plugins.fiftyone.spaces.default` `>`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-usespaces"></a>

### useSpaces

### @fiftyone/spaces.useSpaces(id, defaultState)

* **Arguments:**
  * **id** (`string`)
  * **defaultState** ([`SpaceNodeJSON`](#fiftyone-spaces.SpaceNodeJSON))
* **Return type:**
  `Object`

## Functions

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelarea"></a>

### PanelArea

### @fiftyone/spaces.PanelArea(props)

* **Arguments:**
  * **props** ([`PanelAreaProps`](#fiftyone-spaces.PanelAreaProps))
* **Return type:**
  `Union<` `string` `,` `number` `,` `boolean` `,` `Element` `,` `Iterable < ReactNode >` `>`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelrenderer"></a>

### PanelRenderer

### @fiftyone/spaces.PanelRenderer(props)

* **Arguments:**
  * **props** ([`PanelRendererProps`](#fiftyone-spaces.PanelRendererProps))
* **Return type:**
  `Element`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelskeleton"></a>

### PanelSkeleton

### @fiftyone/spaces.PanelSkeleton()

* **Return type:**
  `Element`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spacesroot"></a>

### SpacesRoot

### @fiftyone/spaces.SpacesRoot(props)

* **Arguments:**
  * **props** ([`SpacesRootProps`](#fiftyone-spaces.SpacesRootProps))
* **Return type:**
  `Element`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-getnodes"></a>

### getNodes

### @fiftyone/spaces.getNodes(node)

* **Arguments:**
  * **node** (`default`)
* **Return type:**
  `Array<` `plugins.fiftyone.spaces.SpaceNode` `>`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-getpanelarearenderer"></a>

### getPanelAreaRenderer

### @fiftyone/spaces.getPanelAreaRenderer(areaId)

* **Arguments:**
  * **areaId** (`string`)
* **Return type:**
  `ReactNode`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-registerpanelarearenderer"></a>

### registerPanelAreaRenderer

### @fiftyone/spaces.registerPanelAreaRenderer(areaId, renderer)

* **Arguments:**
  * **areaId** (`string`)
  * **renderer** (`ReactNode`)
* **Return type:**
  `void`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spacenodefromjson"></a>

### spaceNodeFromJSON

### @fiftyone/spaces.spaceNodeFromJSON(json, parent)

* **Arguments:**
  * **json** ([`SpaceNodeJSON`](#fiftyone-spaces.SpaceNodeJSON))
  * **parent** (`default`)
* **Return type:**
  `plugins.fiftyone.spaces.default`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-unregisterpanelarearenderer"></a>

### unregisterPanelAreaRenderer

### @fiftyone/spaces.unregisterPanelAreaRenderer(areaId)

* **Arguments:**
  * **areaId** (`string`)
* **Return type:**
  `void`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-warnpanelnotfound"></a>

### warnPanelNotFound

### @fiftyone/spaces.warnPanelNotFound(name)

* **Arguments:**
  * **name** ([`SpaceNodeType`](#fiftyone-spaces.SpaceNodeType))
* **Return type:**
  `any`

## Types

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-addpanelbuttonprops"></a>

### *class* @fiftyone/spaces.AddPanelButtonProps()

### AddPanelButtonProps

| Name                        | Type                                | Description   |
|-----------------------------|-------------------------------------|---------------|
| AddPanelButtonProps.node    | `plugins.fiftyone.spaces.SpaceNode` |               |
| AddPanelButtonProps.spaceId | `string`                            |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-addpanelitemprops"></a>

### *class* @fiftyone/spaces.AddPanelItemProps()

### AddPanelItemProps

| Name                        | Type                                    | Description   |
|-----------------------------|-----------------------------------------|---------------|
| AddPanelItemProps.Icon      | `React.ComponentType`                   |               |
| AddPanelItemProps.label     | `string`                                |               |
| AddPanelItemProps.name      | `plugins.fiftyone.spaces.SpaceNodeType` |               |
| AddPanelItemProps.node      | `plugins.fiftyone.spaces.SpaceNode`     |               |
| AddPanelItemProps.onClick   | `(` `)`                                 |               |
| AddPanelItemProps.showAlpha | `boolean`                               |               |
| AddPanelItemProps.showBeta  | `boolean`                               |               |
| AddPanelItemProps.showNew   | `boolean`                               |               |
| AddPanelItemProps.spaceId   | `string`                                |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelareaprops"></a>

### *class* @fiftyone/spaces.PanelAreaProps()

### PanelAreaProps

| Name                  | Type                                 | Description   |
|-----------------------|--------------------------------------|---------------|
| PanelAreaProps.id     | `plugins.fiftyone.spaces.PANEL_AREA` |               |
| PanelAreaProps.resize | `Object`                             |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-paneliconprops"></a>

### *class* @fiftyone/spaces.PanelIconProps()

### PanelIconProps

| Name                | Type                                    | Description   |
|---------------------|-----------------------------------------|---------------|
| PanelIconProps.name | `plugins.fiftyone.spaces.SpaceNodeType` |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelidtoscopetype"></a>

### *class* @fiftyone/spaces.PanelIdToScopeType()

### PanelIdToScopeType

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelprops"></a>

### *class* @fiftyone/spaces.PanelProps()

### PanelProps

| Name                    | Type                                | Description   |
|-------------------------|-------------------------------------|---------------|
| PanelProps.isModalPanel | `boolean`                           |               |
| PanelProps.node         | `plugins.fiftyone.spaces.SpaceNode` |               |
| PanelProps.spaceId      | `string`                            |               |
| PanelProps.style        | `React.CSSProperties`               |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelrendererprops"></a>

### *class* @fiftyone/spaces.PanelRendererProps()

### PanelRendererProps

| Name                    | Type     | Description   |
|-------------------------|----------|---------------|
| PanelRendererProps.id   | `string` |               |
| PanelRendererProps.name | `string` |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelstateparameter"></a>

### *class* @fiftyone/spaces.PanelStateParameter()

### PanelStateParameter

| Name                        | Type      | Description   |
|-----------------------------|-----------|---------------|
| PanelStateParameter.local   | `boolean` |               |
| PanelStateParameter.panelId | `string`  |               |
| PanelStateParameter.scope   | `string`  |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelstatepartialparameter"></a>

### *class* @fiftyone/spaces.PanelStatePartialParameter()

### PanelStatePartialParameter

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-paneltabprops"></a>

### *class* @fiftyone/spaces.PanelTabProps()

### PanelTabProps

| Name                  | Type                                | Description   |
|-----------------------|-------------------------------------|---------------|
| PanelTabProps.active  | `boolean`                           |               |
| PanelTabProps.node    | `plugins.fiftyone.spaces.SpaceNode` |               |
| PanelTabProps.spaceId | `string`                            |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelscloseeffect"></a>

### *class* @fiftyone/spaces.PanelsCloseEffect()

### PanelsCloseEffect

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panelsstateobject"></a>

### *class* @fiftyone/spaces.PanelsStateObject()

### PanelsStateObject

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spacenodejson"></a>

### *class* @fiftyone/spaces.SpaceNodeJSON()

### SpaceNodeJSON

| Name                      | Type                                                 | Description   |
|---------------------------|------------------------------------------------------|---------------|
| SpaceNodeJSON.activeChild |                                                      |               |
| SpaceNodeJSON.children    | `Array<` `plugins.fiftyone.spaces.SpaceNodeJSON` `>` |               |
| SpaceNodeJSON.id          |                                                      |               |
| SpaceNodeJSON.layout      |                                                      |               |
| SpaceNodeJSON.pinned      |                                                      |               |
| SpaceNodeJSON.sizes       | `Array<` `number` `>`                                |               |
| SpaceNodeJSON.type        |                                                      |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spacenodetype"></a>

### *class* @fiftyone/spaces.SpaceNodeType()

### SpaceNodeType

Union of `EnumType`, `string`

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spaceprops"></a>

### *class* @fiftyone/spaces.SpaceProps()

### SpaceProps

| Name                 | Type                                | Description   |
|----------------------|-------------------------------------|---------------|
| SpaceProps.archetype | `Union<` `'grid'` `,` `'modal'` `>` |               |
| SpaceProps.id        | `string`                            |               |
| SpaceProps.node      | `plugins.fiftyone.spaces.SpaceNode` |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-spacesrootprops"></a>

### *class* @fiftyone/spaces.SpacesRootProps()

### SpacesRootProps

| Name                         | Type                                    | Description   |
|------------------------------|-----------------------------------------|---------------|
| SpacesRootProps.defaultState | `plugins.fiftyone.spaces.SpaceNodeJSON` |               |
| SpacesRootProps.id           | `string`                                |               |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-splitpanelbuttonprops"></a>

### *class* @fiftyone/spaces.SplitPanelButtonProps()

### SplitPanelButtonProps

| Name                          | Type                                | Description   |
|-------------------------------|-------------------------------------|---------------|
| SplitPanelButtonProps.layout  | `plugins.fiftyone.spaces.Layout`    |               |
| SplitPanelButtonProps.node    | `plugins.fiftyone.spaces.SpaceNode` |               |
| SplitPanelButtonProps.spaceId | `string`                            |               |

## Enums

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-layout"></a>

### Layout

| Name       | Value   |
|------------|---------|
| Horizontal |         |
| Vertical   |         |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-panel-area"></a>

### PANEL_AREA

| Name               | Value   |
|--------------------|---------|
| GRID_SIDEBAR_RIGHT |         |

<a id="fos-fiftyone-fiftyone-fiftyone-spaces-space-types"></a>

### SPACE_TYPES

| Name            | Value   |
|-----------------|---------|
| EMPTY           |         |
| PANEL_CONTAINER |         |
