Skip to content

[Slider] Allow individual name attribute on each thumb. #2454

Closed
@nd55

Description

@nd55

Feature request

Overview

Hello there :)

I implemented a Radix Slider inside a search/filter form with two Thumbs in an app I am currently building. Currently, only <Slider.Root> allows one name as attribute and both auto generated hidden inputs get the same name appended with []:

<Slider.Root name="testname">{/* Current result */}
<input value="46" style="display: none;" name="testname[]">
<input value="101" style="display: none;" name="testname[]">

For my use case have a range with a min- and max-value for a given setting. When submitting the form, I need both of these values to have a different name, filters[layout][space][min] and filters[layout][space][max].

I'd like to propose the option to give each Thumb an individual name, which would look like this:

<Slider.Root   >
  <Slider.Track>
    <Slider.Range />
  </Slider.Track>

  <Slider.Thumb name="filters[layout][space][min]" />
  <Slider.Thumb name="filters[layout][space][max]" />
</Slider.Root>

{/* Result */}
<input value="46" style="display: none;" name="filters[layout][space][min]">
<input value="101" style="display: none;" name="filters[layout][space][max]">

If no individual name is provided, it would fallback to the Root's name, or otherwise no name.

Thank you for reading – I'd appreciate any feedback or considerations regarding this feature proposal. ☺️

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions