Skip to content

@drawerly/react / UseDrawerlyResult

UseDrawerlyResult<TDrawerOptions>

Returned by useDrawerly.

Extends

Type Parameters

TDrawerOptions

TDrawerOptions extends ReactDrawerOptions = ReactDrawerOptions

Properties

bringToTop()

ts
bringToTop: (key) => void;

Moves the drawer with the given key to the top of the stack.

Parameters

key

string

Returns

void

Inherited from

ts
Drawerly.bringToTop

close()

ts
close: (key?) => void;

Closes the top drawer or the drawer with the given key.

Parameters

key?

string

Returns

void

Inherited from

ts
Drawerly.close

closeAll()

ts
closeAll: () => void;

Closes all drawers.

Returns

void

Inherited from

ts
Drawerly.closeAll

getDefaultOptions()

ts
getDefaultOptions: () => DrawerDefaultOptions<TDrawerOptions>;

Returns the current global default options.

Returns

DrawerDefaultOptions<TDrawerOptions>

Inherited from

ts
Drawerly.getDefaultOptions

getDrawerInstance()

ts
getDrawerInstance: (key) => TDrawerOptions | undefined;

Returns a drawer instance by key, if it exists.

Parameters

key

string

Returns

TDrawerOptions | undefined

Inherited from

ts
Drawerly.getDrawerInstance

getState()

ts
getState: () => DrawerState<TDrawerOptions>;

Returns the current drawer state.

Returns

DrawerState<TDrawerOptions>

Inherited from

ts
Drawerly.getState

getTopDrawer()

ts
getTopDrawer: () => TDrawerOptions | undefined;

Returns the topmost drawer instance, if any.

Returns

TDrawerOptions | undefined

Inherited from

ts
Drawerly.getTopDrawer

isOpen()

ts
isOpen: (key) => boolean;

Returns whether a drawer with the given key is in the stack.

Parameters

key

string

Returns

boolean

Inherited from

ts
Drawerly.isOpen

open()

ts
open: (options) => string;

Opens a drawer at the top of the stack. Options of an already open drawer are replaced.

Parameters

options

TDrawerOptions

Returns

string

Inherited from

ts
Drawerly.open

stack

ts
stack: readonly TDrawerOptions[];

Current drawer stack. The last item is the topmost drawer.


subscribe()

ts
subscribe: (listener) => Unsubscribe;

Subscribes to state changes.

Parameters

listener

DrawerListener<TDrawerOptions>

Returns

Unsubscribe

Inherited from

ts
Drawerly.subscribe

updateDefaultOptions()

ts
updateDefaultOptions: (patch) => void;

Merges a patch into the global default options used for future drawers.

Parameters

patch

DrawerDefaultOptions<TDrawerOptions>

Returns

void

Inherited from

ts
Drawerly.updateDefaultOptions

updateOptions()

ts
updateOptions: (key, patch) => void;

Merges a patch into the options of an existing drawer.

Parameters

key

string

patch

DrawerPatch<TDrawerOptions>

Returns

void

Inherited from

ts
Drawerly.updateOptions

Released under the MIT License.