tremorlabs / tremor

React components to build charts and dashboards
https://tremor.so
Apache License 2.0
15.88k stars 455 forks source link

[Feature]: Improve `DateRangePicker` UX #916

Open filipeveronezi opened 5 months ago

filipeveronezi commented 5 months ago

What problem does this feature solve?

It would be great to have a better UX with the DateRangePicker component.

Here are some problems that I see related to the current UX:

1. When a date range is already selected:

a. The first click before the selected date range changes the value of from.

b. The first click inside or after the selected date range changes the value of to.

Here's a use case where I think this is bad UX: if a date range of 9 - 18 is selected and the user wants to select 10 - 19, I guess the fastest way would be double clicking 10 and then clicking 19, which is not intuitive at all.

Another option would be using the "X" icon to clear the selected range and then select the desired range, but this leads the user to move off the Popover context and execute a 2-step action, personally I had to stop and think before doing this at my first ever interaction with this component.

This behavior is probably okay if the initial state of the input is empty (still not the best imo), but I'm working on a project where the initial input state is set to "last 7 days", which makes this behavior really unintuitive for users who want to change the date range completely. It gets worse if you think of a possible real application where the onChange event triggers some data loads and disable the input while loading, making the user wait for a range selected by mistake because of unintuitive UI.

Suggested solution

2. When minValue or maxValue is defined, there's no visual/interactive representation of date range limitation

Here's an example where I try to select a not allowed date and have to come back to actually discover a range limit:

Suggested solution

3. Popover looks weird in the disabled state

Suggested solutions

Final considerations

severinlandolt commented 5 months ago

Thank you for your details issue/feature report! 🙏 Definitely something we aim to improve in one of the next releases, will come back to this we are working on that!

filipeveronezi commented 5 months ago

@severinlandolt Nice! Looking forward for it, let me know if I can help with anything 😁