shadowThe Range slider lets users select from a range of values by moving the slider knob. By default one knob controls the value of the range. This behavior can be customized using dual knobs.
By default the Range slider has a minimum value of 0
and a maximum value of 100
. This can be configured with the min
and max
properties.
Labels and custom UI elements can be slotted on either side of the range by adding slot="start"
or slot="end"
to the element. The element can be any element, such as an ion-label
, ion-icon
or a div
. If the directionality of the document is set to left to right, the contents slotted to the start
position will display to the left of the range, where as contents slotted to the end
position will display to the right of the range. In right to left (rtl) directionality, the contents slotted to the start
position will display to the right of the range, where as contents slotted to the end
position` will display to the left of the range.
Dual knobs introduce two knob controls that users can use to select a value at a lower and upper bounds. When selected, the Range will emit an ionChange
event with a RangeValue, containing the upper and lower values selected.
The pin
attribute will display the value of the Range above the knob when dragged. This allows users to select a specific value within the Range.
With the pinFormatter
function, developers can customize the formatting of the range value to the user.
Ticks show indications for each available value on the Range. In order to use ticks, developers must set both snaps
and the ticks
property to true
.
With snapping enabled, the Range knob will snap to the nearest available value as the knob is dragged and released.
The ionChange
event emits as the Range knob value changes.
The ionKnobMoveStart
event emits when the Range knob begins dragging, whether through mouse drag, touch gesture or keyboard interaction. Inversely, ionKnobMoveEnd
emits when the Range knob is released. Both events emit with the RangeValue
type and work in combination with the dualKnobs
property.
Range includes CSS Variables to quickly theme and customize the appearance of the Range component to match your application's design.
Range includes CSS Shadow Parts to allow complete customization of specific element nodes within the Range component. CSS Shadow Parts offer the most customization capabilities and are the recommended approach when requiring advance styling with the Range component.
interface RangeChangeEventDetail {
value: RangeValue;
}
interface RangeKnobMoveStartEventDetail {
value: RangeValue;
}
interface RangeKnobMoveEndEventDetail {
value: RangeValue;
}
While not required, this interface can be used in place of the CustomEvent
interface for stronger typing with Ionic events emitted from this component.
interface RangeCustomEvent extends CustomEvent {
detail: RangeChangeEventDetail;
target: HTMLIonRangeElement;
}
type RangeValue = number | { lower: number; upper: number };
Description | The start position of the range active bar. This feature is only available with a single knob (dualKnobs="false"). Valid values are greater than or equal to the min value and less than or equal to the max value. |
Attribute | active-bar-start |
Type | number | undefined |
Default | undefined |
Description | The color to use from your application's color palette. Default options are: "primary" , "secondary" , "tertiary" , "success" , "warning" , "danger" , "light" , "medium" , and "dark" . For more information on colors, see theming. |
Attribute | color |
Type | "danger" | "dark" | "light" | "medium" | "primary" | "secondary" | "success" | "tertiary" | "warning" | string | undefined |
Default | undefined |
Description | How long, in milliseconds, to wait to trigger the ionChange event after each change in the range value. This also impacts form bindings such as ngModel or v-model . |
Attribute | debounce |
Type | number |
Default | 0 |
Description | true の場合、ユーザは範囲と対話することができません。 |
Attribute | disabled |
Type | boolean |
Default | false |
Description | 2つのノブを表示します。 |
Attribute | dual-knobs |
Type | boolean |
Default | false |
Description | 範囲の最大整数値。 |
Attribute | max |
Type | number |
Default | 100 |
Description | 範囲の最小の整数値。 |
Attribute | min |
Type | number |
Default | 0 |
Description | modeは、どのプラットフォームのスタイルを使用するかを決定します。 |
Attribute | mode |
Type | "ios" | "md" |
Default | undefined |
Description | フォームデータとともに送信されるコントロールの名前。 |
Attribute | name |
Type | string |
Default | '' |
Description | If true , a pin with integer value is shown when the knob is pressed. |
Attribute | pin |
Type | boolean |
Default | false |
Description | A callback used to format the pin text. By default the pin text is set to Math.round(value) . |
Attribute | undefined |
Type | (value: number) => string | number |
Default | (value: number): number => Math.round(value) |
Description | If true , the knob snaps to tick marks evenly spaced based on the step property value. |
Attribute | snaps |
Type | boolean |
Default | false |
Description | 値の粒度を指定します。 |
Attribute | step |
Type | number |
Default | 1 |
Description | If true , tick marks are displayed based on the step value. Only applies when snaps is true . |
Attribute | ticks |
Type | boolean |
Default | true |
Description | 範囲の値です。 |
Attribute | value |
Type | number | { lower: number; upper: number; } |
Default | 0 |
Name | Description |
---|
ionBlur | レンジの焦点が合わなくなったときに発行されます。 |
ionChange | valueプロパティが変更されたときに発行されます。 |
ionFocus | レンジのフォーカスが合ったときに発行されます。 |
ionKnobMoveEnd | Emitted when the user finishes moving the range knob, whether through mouse drag, touch gesture, or keyboard interaction. |
ionKnobMoveStart | Emitted when the user starts moving the range knob, whether through mouse drag, touch gesture, or keyboard interaction. |
No public methods available for this component.
Name | Description |
---|
bar | バーの非アクティブな部分。 |
bar-active | バーのアクティブな部分です。 |
knob | 範囲をドラッグする際に使用するハンドル。 |
pin | ノブの上に表示されるカウンターです。 |
tick | 非アクティブなティックマークです。 |
tick-active | アクティブなティックマークです。 |
Name | Description |
---|
--bar-background | レンジバーの背景 |
--bar-background-active | アクティブレンジバーの背景 |
--bar-border-radius | レンジバーのボーダー半径 |
--bar-height | レンジバーの高さ |
--height | レンジの高さ |
--knob-background | レンジノブの背景 |
--knob-border-radius | レンジツマミのボーダー半径 |
--knob-box-shadow | レンジノブのボックスシャドウ |
--knob-size | レンジツマミの大きさ |
--pin-background | レンジピンの背景(MD mode時のみ有効) |
--pin-color | レンジピンの色(MD mode時のみ有効) |
Name | Description |
---|
end | コンテンツは、LTRでは範囲スライダーの右側に、RTLでは左側に配置されます。 |
start | コンテンツは、LTRでは範囲スライダーの左側に、RTLでは右側に配置されます。 |