-
Notifications
You must be signed in to change notification settings - Fork 2
Slider
The Slider component is a custom React component designed to create a draggable slider for adjusting values within a specified range. It's ideal for settings requiring user input for value adjustments, like volume controls or progress bars. The component includes audio feedback for interactions and supports custom styling.
To use the Slider component in your React application, import it as follows:
const { Slider } = window.$_gooee.framework;The Slider component is used to display a draggable slider, allowing users to select or adjust a value within a range. It supports custom styling and provides an audio feedback feature for interactions.
The Slider component accepts the following props:
-
className: Additional CSS class names to apply to the slider. -
value: The initial value of the slider. -
onValueChanged: Function to be called when the slider value changes. It receives the new value as an argument. -
style: CSS styles to apply to the slider.
- Draggable Slider: Allows users to adjust the value by dragging the slider.
-
State Management: Manages its value state internally and syncs with the
valueprop. - Custom Styling: Can be styled via CSS classes and inline styles.
-
Audio Feedback: Provides audio feedback for interactions using the
engine.triggermethod.
The component uses the form-slider class as its base, which can be extended or overridden with additional classes passed through the className prop. The form-slider-grip class is used for the draggable part of the slider.
- The slider's value changes upon dragging the grip.
- Audio feedback is played on grab, drag, and release events.
<Slider
value={50}
onValueChanged={(newValue) => console.log(newValue)}
/><Slider
className="slider-danger"
value={30}
onValueChanged={(newValue) => console.log(newValue)}
/>Contributions to improve the Slider component are welcomed. Follow the project's contribution guidelines for submitting bug fixes, feature requests, or enhancements.