EQWorks / lumen-labs

React library of basic components based on Tailwind CSS
https://eqworks.github.io/lumen-labs
5 stars 2 forks source link

Components Library: Slider #116

Open vlatawiec opened 2 years ago

vlatawiec commented 2 years ago

🎯 Usage

🎭 Types

πŸ«€ Anatomy

COMPONENTANATOMY

Spacing, Sizing & Alignment:

⌨️ Keyboard Accessibility

Keyboard shortcuts for selected/focused slider thumb movement

πŸ”— Zeplin Link

πŸ”’ Attributes

Property Type Default Value Description
disabled Boolean 'false' Disables the slider
range Boolean 'false' Determines whether the slider has a single value, or a range selection (single [false] or dual [true] thumb).
stepper Boolean 'false' Determines whether the slider is formatted as a stepper or as default.
vertical Boolean 'false' Determines whether the slider is horizontal or vertical.
max Number '-' The maximum value that a slider can have
min Number '-' The minimum value that a slider can have
step Number '-' The values at which the stepper thumb will snap to
sliderLabel Boolean 'true' Determines whether slider limit labels are shown or not.
stepInterval Number '-' How often to show steps. (Step interval of 4, with a step of 3 will create a step every 12 values.
value Number '-' Value of the slider thumb
valueText Number '-' Display text (within the input box) of the slider's value.
defaultValue String | Number '0' The default value that a slider is displayed at
percent Number '-' The percentage of the slider track that coincides with the thumb value

πŸ” Design Preview

Slider

woozyking commented 2 years ago

what is the significance of the round sliding ~control~ thumb (for horizontal) and the ~rectangle one (for vertical)? why the different shape?

control

vlatawiec commented 2 years ago

what is the significance of the round sliding ~control~ thumb (for horizontal) and the ~rectangle one (for vertical)? why the different shape?

control

The smaller vertical slider allows for a higher stepper count, making it a better choice for use cases that require a high range of specified values. Otherwise, the difference is mainly just aesthetic, to create some contrast between the two! Realistically, the horizontal thumb could be used for both, the rectangular thumb just emphasizes the difference

woozyking commented 2 years ago

makes sense

in the case of mostly aesthetics, should we allow this to be configurable? such that, in imaginary usage scenario, for example:

<Slider
  orientation='horizontal'
  thumb='rectangle'
  ...
/>

which would then render, by user's choice, as a horizontal slider with a rectangle thumb (but obviously situated perpendicularly with the sliding bar itself)

but if the stepper is applied, then the thumb property can be inferred accordingly, something like:

<Slider
  with [...specific range of values]
  // thumb inferred to be rectangle, or round if not specific range of values
  // and the verticle slider by default implies stepper use-case
/>
vlatawiec commented 2 years ago

makes sense

in the case of mostly aesthetics, should we allow this to be configurable? such that, in imaginary usage scenario, for example:

<Slider
  orientation='horizontal'
  thumb='rectangle'
  ...
/>

which would then render, by user's choice, as a horizontal slider with a rectangle thumb (but obviously situated perpendicularly with the sliding bar itself)

but if the stepper is applied, then the thumb property can be inferred accordingly, something like:

<Slider
  with [...specific range of values]
  // thumb inferred to be rectangle, or round if not specific range of values
  // and the verticle slider by default implies stepper use-case
/>

That could definitely be something added in the future! Since that will require the design of a configuration/setting section (to allow users to switch slider thumb design), it would be best to implement that fully in a future iteration, based on user need/want. But thats a good idea for lumen-labs as a design system to allow for that customization.