Skip to content

[drawer] Feature request: adding payload to certain Drawer.SwipeArea for modularity #4908

@Julchu

Description

@Julchu

Feature request

Summary

  • When Drawer.SwipeArea is triggered, is it possible to pass payload such as if using custom handle and payload in triggers?
    Currently SwipeArea only triggers undefined payload
export const customHandle = Drawer.createHandle<string>();
customHandle.openWithPayload("drawer screen 1");
customHandle.openWithPayload("drawer screen 2");
customHandle.openWithPayload("drawer screen 3");

...
 <Drawer.Root handle={customHandle}>
    {({ payload }) => {
      if (payload === 'drawer screen 1') return <p>drawer screen 1</p>
      if (payload === 'drawer screen 2') return <p>drawer screen 2</p>
      if (payload === 'drawer screen 3') return <p>drawer screen 3</p>
    }}
</Drawer.Root>

Examples in other libraries

Motivation

If I have a shelf/fridge/pantry feature in a Grocery app, it'd be useful to open specific shelves/pantry drawer/fridge space

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: drawerChanges related to the drawer component.type: new featureExpand the scope of the product to solve a new problem.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions