Range Slider customisation

I have a few questions around customising the range slider’s filter behaviour and UI appearances. I have a few goals for these, so I’ll try list them out clearly:

———

Only filter when the user interacts with a range slider
I’m wondering if there’s a way of stopping range sliders from filtering the page by default on page load? I am using a few range sliders on a relatively complex filter system and on page load, I’m getting results from the range sliders min/max values when I would rather the filters are inactive until the user interacts with them and sets some parameters.

I can achieve what I want by clearing the filter / all filters, but this isn’t really a practicable solution to expect the user to do, and if I were to have this done programatically on page load, any pre-filtered pages using query parameters would break.

———

Override the min/max without affecting the UI
I am getting the request from our client to make the price filter for houses to be from $600k to $2.5M+, but they have listings lower than $600k and higher than $2.5M. So I was wondering if it was possible for the inputs received a different number whenever the handles were either on the min/max positions.

For example; the UI shows the min of $600k, but the filter input receives $200k, as soon as the user moves the handle up to the next $100k increment, the filter receives $700k as it usually would. Similarly for the max end; the UI shows $2.5M+, but the filter input receives a huge number like $999M to catch all of their more expensive listings. Then when the user pulls the handle down to $2.4M, the input receives that value as expected.

Oh and a wee side note, the + to conditionally show whenever the handle is at the max would definitely keep the client happy and the UX on point!

———

Custom number formatting
As you saw in the previous query, we’re dealing with fairly large numbers, so having these written out as $2,500,000 is quite restrictive in terms of space in the UI, especially at narrower viewports. Would it be possible to override the standard number formatting with commas (or not use it and have a custom solution) that changes all numbers in the hundreds of thousands to abbreviate to $200k / $400k / $600k etc., and all numbers in the millions to abbreviate to $2M / $2.5M and so on.

———

Syncing values between two instances of the same range slider filter
I have designed a UI that utilises a sticky top bar on desktop with the key filters for homes like; Location (not a range slider), Price, Bedrooms, and Bathrooms. I then have a button that opens up a full height drawer with the full list of filters, which include the same as above, plus other more granular filters.

My goal is to have the two instances of the price filter in sync, same with bedrooms and bathrooms. I am thinking that my drilldown menu of regions, subregions and suburbs in the location filter (a whole menu structure of radio buttons) will be a whole other kettle of fish, and I’m thinking about some custom JS that stores the values in localStorage and programatically keeps these two in sync. But, I’m keen to know what you guys think about keeping duplicates of range sliders in sync.

———

Help on any of these goals would be hugely appreciated, I’m not sure a project link would be that useful to you guys on these questions, as they’re less about fixing something specific, and more about customisation in general.

Anyway, really loving the work you guys have been doing, the update to Attributes v2 is great… really awesome work guys :clap: those new instruction docs pages are :ok_hand: looking forward to the updated complex filter system example and video for v2, if that’s in the pipeline :crossed_fingers: a sincere thank you for all your hard work!

Hey @mark.bridgwater! Thank you for the detailed goals list! I will try to answer everything as clearly as possible below!

Yes! We have recently pushed an update (documentation update incoming) where you can delay the update of the inputs of the Range Sliders until the user interact with them. The list will not load with the min/max values as before. Simply add fs-rangeslider-lazy="true" to each of the range slider fs-rangeslider-element="wrapper" elements.

Interesting setup! While we do not have any native option for this, you can try using the Range Slider API to programmatically update the input values.

You can read more on the API here

This is a great feature request! At the moment, we can only format the numbers using a locale to add the needed value separator 2,394,338 or 2.394.338. Again, we could write some JS to format the display value while we work on this update.

API to the rescue once more! You can set the value of any handle instance to mirror another with the setValue method shown here!

I hope this helps!

Hi @Support-Luis, thank you so much for your response! All really positive knowing that what I’m trying to achieve is actually possible!

I have to apologise for the length of time it’s taken me to reply to you… this project has been a whirlwind with such a crazy time-crunch to launch, and your reply landed while I was on a (poorly timed) week of leave. By the time I was back, a full-stack developer was engaged to help and proceeded to rebuild a large portion of my work in react. I was not stoked, but hey.

Now the site is live, we are facing some serious performance issues with this react component of the site, so I have been asked to pick this back up and see if what we are trying to achieve is 100% possible before committing to the switch back.

Messy I know! But, I should have done the decent thing and thanked you for your response before now, so I’m sorry that this is so late!

Anyway, moving forward, I have a few follow-on questions based on your responses… generally, I’d be a little lost with the custom JS / API work as I’m not able to write my own JS. I have managed to get a decent amount of JS working for other things using AI, but these filters proved trickier for me, possibly due to the newness of the v2 Attributes.

I’ll try reply to each specific point now for clarity:

(Only filter when the user interacts with a range slider)
This is amazing, this will be one of the things I test out first once I can establish our goals are all achievable.

(Override the min/max without affecting the UI)
I guess this is lower priority, as I can just set a lower/higher min/max and the client will have to accept the the compromise / limitation.

(Custom number formatting)
Thank you, hopefully this spurs some additional useful functionality for the community! Again though—in the short term this is a lower priority for this project and we can use a work-around.

(Syncing values between two instances of the same range slider filter)
This is the one I have a few more questions on. As above, I’m not so clued up on writing my own JS, so some guidance would be amazing if possible?

With the duplicate rangeslider filters; if I have two “bedrooms” range sliders for instance (to filter how many bedrooms the house listings have), do they need to have the same fs-rangeslider-instance=“bedrooms” between both, or do they need to be different for the rangeslider to function properly?

Then as far as the filter functionality is concerned, I’m assuming the fs-list-field=“bedrooms” attributes on the two fs-list-operator inputs will need to match on both instances of the bedrooms rangesliders? Will this work, and will using setValue update the filterable inputs—effectively achieving a two-way sync between two instances of the same rangeslider?

Similar questions around non-rangeslider filters in the same system, like a series of radio filters for instance that need to appear on the page twice but stay in sync. Hopefully the method you advise me on can be a catch-all for all filters in this system.

Hopefully this all makes sense to you. Again, thank you so much for your time on this support, really much appreciated!