Range Stepper Ready
range-stepper is a component that can be used to step through a series of value ranges
Examples #
<div slot="main">
<duet-card heading="Default range stepper">
<duet-range-stepper id="duet-range-stepper"></duet-range-stepper>
</duet-card>
</div>
</duet-layout>
<script>
(function(){
const stepper = document.querySelector('#duet-range-stepper');
stepper.addEventListener('duetRangeStepUpdate', (e) => {
console.log(e.detail);
});
}())
</script>
<div slot="main">
<duet-card heading="Range stepper with pagination">
<duet-pagination id="duet-range-stepper_with_pagination-pagination" total="1000" visible-items="5" take="10">
</duet-pagination>
<hr>
<duet-range-stepper id="duet-range-stepper_with_pagination-stepper" step-size="200"></duet-range-stepper>
</duet-card>
</div>
</duet-layout>
<script>
(function(){
const stepper = document.querySelector('#duet-range-stepper_with_pagination-stepper');
const pagination = document.querySelector('#duet-range-stepper_with_pagination-pagination');
stepper.total = pagination.total;
stepper.addEventListener('duetRangeStepUpdate', (e) => {
console.log(e.detail);
const from = e.detail.from;
pagination.current=from/pagination.take;
});
pagination.addEventListener('duetPageChange', (e) => {
console.log(e.detail);
});
}())
</script>
Properties #
Property | Attribute | Description | Type | Default |
---|---|---|---|---|
ariaControls | accessible-controls | Used to indicate which dom element with ID this element controls | string | "" |
ariaLabels | -- | Default pagination labels | { [x: string]: string; } | getLocaleString( this.ariaLabelsDefaults ) |
ariaLabelsDefaults | -- | Default range stepper labels | DuetLangObject | { en: { next_increment: "Next range increment", previous_increment: "Previous range increment", x_of_y: "{0}–{1} of {2}", }, fi: { next_increment: "Seuraava välillä", previous_increment: "Edellinen välillä", x_of_y: "{0}–{1} / {2}", }, sv: { next_increment: "Nästa intervall", previous_increment: "Föregående intervall", x_of_y: "{0}–{1} av {2}", }, } |
disabled | disabled | Makes the controls of range-stepper component disabled. | boolean | false |
stepIndex | step-index | Start value | number | 1 |
stepSize | step-size | How big is the step | number | 50 |
theme | theme | Theme of the component. | "" | "default" | "turva" | "" |
total | total | Total of | number | 1000 |
Events #
Event | Description | Type |
---|---|---|
duetRangeStepUpdate | Event emitted when the step heading is clicked. | CustomEvent<{ originalEvent: KeyboardEvent | MouseEvent; component: "duet-range-stepper"; from: number; to: number; index: number; }> |
Shadow Parts #
Part | Description |
---|---|
"navigation-arrow" | this part enables style overrides for the navigation-arrow |
"range-numbers" | this part enables style overrides for the range-numbers |
Usage #
This section includes guidelines for designers and developers about the usage of this component in different contexts.
When to use #
- When you need to step through ranges of values
When not to use #
- As a number input field - please use duet-number-input instead
Accessibility #
This component has been validated to meet the WCAG 2.1 AA accessibility guidelines. You can find additional information regarding accessibility of this component below.
Integration
For integration, event and theming guidelines, please see Using Components. This documentation explains how to implement and use Duet’s components across different technologies like Angular, React or Vanilla JavaScript.
Tutorials
Follow these practical tutorials to learn how to build simple page layouts using Duet’s CSS Framework, Web Components and other features:
Building Layouts
TutorialsUsing CLI Tools
TutorialsCreating Custom Patterns
TutorialsServer Side Rendering
TutorialsSharing Prototypes
TutorialsUsage With Markdown
Troubleshooting
If you experience any issues while using a component, please head over to the Support page for more guidelines and help.