a suite of UI Components for development of web apps
If you have any questions, don't hesitate to contact us at support@lidorsystems.com
Advanced User Interface Controls and Components
IntegralUI Slider is a native web component for Angular, React and Vue that allow you to change a numeric value within a range of defined minimum and maximum values. In this article, you will find general information about the slider component, including its properties, events and methods that you can use.
If you have any questions, don't hesitate to contact us at support@lidorsystems.com
In this demo, there are two sliders: with a rectangle and round thumb button. You can move the slider by dragging it or by clicking the mouse to either side. You can also change the slider value with the mouse wheel.
Whenever the mouse hovers over the slider, the current slider position and the thumb button will become highlighted. The thumb button is transparent, except of its border. You can customize this using different colors or shapes via CSS.
To use the Slider component you need to do the following:
By default, slider component has horizontal orientation and can move from minimum to the maximum value from left to right. You can change the orientation to vertical by setting the orientation property. In this case, the minimum value is at the bottom and you can move the slider to the maximum value at the top.
import { IntegralUIOrientation } from './integralui/components/integralui.core';
. . .
public ctrlOrientation: IntegralUIOrientation = IntegralUIOrientation.Vertical;
<iui-slider [(ngModel)]="ctrlValue" [orientation]="ctrlOrientation"></iui-slider>
Slider component is also usable as part of other components. For example, you can place a slider to the Toolbar component or add a slider to the cells in the Grid or TreeGrid component. Simply, place the slider in the cell template, and when grid updates it will show the slider inside the specified cell.
This component supports ngModel directive and can be used within Angular Forms.
You can use the following properties to change the appearance and behavior of the Slider component:
Using the above properties, you can customize the Slider component in a way best suited for your application.
Here is a list of available events:
The valueChanged event is fired whenever the slider value changes. You can handle this event in your code and set an action based on the current slider value.
sliderValueChanged(e: any){
console.log("Current slider value is: ", e.value);
}
<iui-slider [(ngModel)]="ctrlValue" (valueChanged)="sliderValueChanged($event)"></iui-slider>
The following public methods are available:
Several CSS classes govern the appearance of the Slider component, including animations. You can modify the slider appearance by changing the attributes of these classes or by providing your own CSS style sheet that will override the default appearance.
For this purpose, you can use the controlStyle property, where you need to specify the names of your CSS classes, for slider state (disabled, focused, hovered, normal and selected) and part that you want to change:
sliderStyle = {
general: {
disabled: 'iui-slider-disabled',
focused: 'iui-slider-focused',
normal: 'iui-slider',
hovered: 'iui-slider-hovered',
selected: 'iui-slider-selected'
},
content: {
disabled: 'iui-slider-content-disabled',
focused: 'iui-slider-content-focused',
normal: 'iui-slider-content',
hovered: 'iui-slider-content-hovered',
selected: 'iui-slider-content-selected'
},
slider: {
background: {
disabled: 'iui-slider-background-disabled',
focused: 'iui-slider-background-focused',
normal: 'iui-slider-background',
hovered: 'iui-slider-background-hovered',
selected: 'iui-slider-background-selected'
},
button: {
disabled: 'iui-slider-button'-disabled',
focused: 'iui-slider-button'-focused',
normal: 'iui-slider-button',
hovered: 'iui-slider-button'-hovered',
selected: 'iui-slider-button'-selected'
}
}
}
In this example, the second slider has a thumb button appear as circle. A new CSS class is used that alters the button size and border shape.
public ctrlStyleRound: any = {
general: { normal: 'sld-ovw' },
slider: {
button: { normal: 'sld-ovw-slider-round' }
}
}
<iui-slider [(ngModel)]="ctrlValue2" [controlStyle]="ctrlStyleRound"></iui-slider>
.sld-ovw
{
width: 300px;
height: 20px;
}
.sld-ovw-slider-round
{
border-radius: 9px;
width: 16px !important;
height: 16px !important;
}
To disable animations of the slider state, you can simply set the allowAnimation property to false.
IntegralUI Slider is a web component that you can use in Angular, React and Vue. It allows you to change a numeric value within a range of defined minimum and maximum values. Using different properties and events and by providing your own CSS classes, you can customize the component appearance and behavior.
The Slider component is part of IntegralUI Web.