react95-io / React95

🌈🕹 Windows 95 style UI component library for React
https://react95.io
MIT License
6.7k stars 187 forks source link

feat(toolbar): add onOutsideClick prop #391

Open williamgrosset opened 10 months ago

williamgrosset commented 10 months ago

Overview

This PR adds an optional onOutsideClick callback prop to the Toolbar component.

From a UX perspective, "toolbars" should close by default on an outside click. Similar to how dropdowns are handled. Since the component itself does not handle visibility, we can add a prop for the consumer to make it easier to implement this behavior.

e.g

<Toolbar onOutsideClick={() => setOpen(false)}>
  ...
</Toolbar>

Kapture 2024-01-14 at 13 34 01

Kapture 2024-01-14 at 13 43 26

Thank you for the awesome library!