# DrawerWidgetSessionMixin

Auto-generated from the @jbrowse/mobx-state-tree model in the source — see the [developer guide](https://jbrowse.org/jb2/docs/developer_guide/) for concepts. Built into JBrowse core. [View source](https://github.com/GMOD/jbrowse-components/blob/main/packages/product-core/src/Session/DrawerWidgets.ts).

Adds the widget drawer to a session: the open widgets, which one is
showing, and the drawer's side, width and minimized state.

## Properties

| Member | Description |
| --- | --- |
| **drawerPosition**<br><code>drawerPosition: types.optional( types.enumeration&lt;DrawerPosition&gt;('DrawerPosition', [ ...drawerPositions, ]), storedDrawerPosition, )</code> |  |
| **drawerWidth**<br><code>drawerWidth: types.stripDefault( types.refinement(types.integer, width =&gt; width &gt;= minDrawerWidth), 384, )</code> |  |
| **widgets**<br><code>widgets: types.stripDefault(types.map(widgetStateModelType), {})</code> |  |
| **activeWidgets**<br><code>activeWidgets: types.stripDefault( types.map(types.safeReference(widgetStateModelType)), {}, )</code> |  |
| **minimized**<br><code>minimized: types.stripDefault(types.boolean, false)</code> |  |

## Volatiles

| Member | Description |
| --- | --- |
| **poppedOut**<br><code>boolean</code> | true while the visible widget is shown in a modal dialog instead of the drawer. Volatile because a restored session that opened straight into a modal, with no drawer behind it, is disorienting |
| **modalWidgets**<br><code>boolean</code> | set by a host with no room for a drawer column beside its views (a phone), so every widget shows in a modal instead |

## Getters

| Member | Description |
| --- | --- |
| **visibleWidget**<br><code>Widget &#124; undefined</code> |  |
| **drawerVisible**<br><code>boolean</code> | whether the drawer column is on screen: there is something to show, it is not minimized to the FAB, and it is not currently a modal instead.<br><br>A getter rather than each host's own `&&`, because the hosts drifted -- the app shell tested `poppedOut` and the embedded view did not, so the day a popout button reaches the embedded drawer header it would render the modal and the drawer at once. |
| **modalWidgetVisible**<br><code>boolean</code> | whether the visible widget shows in a modal: popped out of the drawer, or on a host with no room for one |

## Actions

| Member | Description |
| --- | --- |
| **setDrawerPosition**<br><code>(arg: DrawerPosition) =&gt; void</code> |  |
| **updateDrawerWidth**<br><code>(drawerWidth: number, availableWidth?: number) =&gt; number</code> |  |
| **resizeDrawer**<br><code>(distance: number, availableWidth?: number) =&gt; number</code> |  |
| **addWidget**<br><code>(typeName: string, id: string, initialState?: any, conf?: unknown) =&gt; any</code> |  |
| **showWidget**<br><code>(widget: any) =&gt; void</code> |  |
| **hideWidget**<br><code>(widget: any) =&gt; void</code> | closes the widget, and removes it from the session when its type sets `discardOnClose`. Minimizing the drawer is not closing. |
| **minimizeWidgetDrawer**<br><code>() =&gt; void</code> |  |
| **showWidgetDrawer**<br><code>() =&gt; void</code> |  |
| **popoutWidget**<br><code>() =&gt; void</code> | show the visible widget in a modal dialog, freeing the drawer column |
| **returnWidgetToDrawer**<br><code>() =&gt; void</code> |  |
| **setModalWidgets**<br><code>(flag: boolean) =&gt; void</code> |  |
| **hideAllWidgets**<br><code>() =&gt; void</code> |  |
| **closeModalWidget**<br><code>() =&gt; void</code> | the modal's close button: a popped-out widget goes back to the drawer, and with no drawer to go back to the widget closes |
| **openWidget**<br><code>(typeName: string, id: string, initialState?: any, conf?: unknown) =&gt; any</code> | adds the widget, replacing one with the same id, and shows it |
| **editConfiguration**<br><code>(configuration: AnyConfigurationModel &#124; { trackId: string; }, opts?: { expandedDisplayId?: string &#124; undefined; } &#124; undefined) =&gt; void</code> | opens a configuration editor to configure the given thing, and sets the current task to be configuring it |

