Skip to content
This repository was archived by the owner on Mar 4, 2020. It is now read-only.

Slider component #1539

@bmdalex

Description

@bmdalex

Slider component

Related to #1255

Description

  • a slider is an input that allows the user to choose a value from within a specific range of values
  • sliders typically have a slider thumb that can be moved along a bar or track to change the value of the slider.

image
image

API proposal v1

  • defaultValue?: number | string | string[] - The value of the slider.

  • disabled?: boolean- A slider can be read-only and unable to change states.

  • discrete?: boolean (alternatives: segmented, dotted) - Whether the slider has discrete styling or not.

  • fluid?: boolean - A slider can take the width of its container.

  • input?: ShorthandValue - Shorthand for the input component.

  • max?: string | number - The greatest value in the range of permitted values.

  • min?: string | number - The lowest value in the range of permitted values.

  • vertical?: boolean - The slider orientation. Horizontal by default.

  • step?: string | number - A number that specifies the granularity that the value must adhere to or the special value any.

  • inputRef?: React.Ref<HTMLElement> - Ref for input DOM node.

  • onChange?: ComponentEventHandler<SliderProps> - Change event handler.

  • value?: number | string | string[] - The value of the slider.

v2:

  • items / marks prop

These are predetermined values to which the user can move the slider. If true the marks will be spaced according the value of the step prop. If an array, it should contain objects with value and an optional label keys.
Screenshot 2019-06-24 at 17 47 38

  • Do we need a callback function that is fired when the mouseup is triggered?

PROPOSAL: onChanged , onChangeComitted (other names: onMouseUp, onChangeSubmitted)

  • label prop vs Form.Field?

What should be the preferred way to label a slider? e.g.:
image

  • media prop needed or should we use Flex + Icon or other components?

56600347-51584e00-65ad-11e9-9703-b0159fe95515 (1)

  • valueFormat prop in v1?

Optional function to format the slider value.

  • showValue prop in v1?

Whether to show the value on the right of the Slider.

Inspired from:

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions