レンジスライダReactコンポーネント

    Range Slider Reactコンポーネントは、Range Sliderコンポーネントを表します。

    Range Sliderコンポーネント

    以下のコンポーネントが含まれています。

    • Range (レンジ)

    Range Sliderのプロパティ

    PropTypeDefaultDescription
    <Range> properties
    initbooleantrueレンジスライダの初期化
    valuenumber
    array
    string
    レンジスライダの値。デュアルレンジスライダの場合は配列でなければならない。
    minnumber
    string
    最小値
    maxnumber
    string
    最大値
    stepnumber
    string
    1値の間の最小ステップ
    labelbooleanfalseレンジスライダのノブの周りにラベルを表示
    dualbooleanfalseデュアルレンジスライダを有効にする
    verticalbooleanfalse垂直方向のレンジスライダを有効にする
    verticalReversedbooleanfalse垂直方向のレンジスライダを反転させます。(vertical:true の場合のみ)
    draggableBarbooleantrue有効にすると、レンジバーのクリックやスワイプでレンジスライダーを操作することができます(値の変更)。
    formatLabelfunction(value)メソッドはフォーマットされたレンジノブのラベルテキストを返さなければなりません。引数として、ラベルの値を受け取ります。
    scalebooleanfalseレンジスライダーのスケールを有効にする
    scaleStepsnumber5スケールのステップ数
    scaleSubStepsnumber0スケールのサブステップの数(各ステップはこの値で分割されます
    formatScaleLabelfunction (value)メソッドはフォーマットされたスケール値を返さなければならない。引数として、現在のスケールステップ値を受け取ります。このメソッドは、各スケールステップごとに呼び出されます。
    limitKnobPositionbooleanノブの位置をレンジバーの大きさに制限します。デフォルトでは、iOSテーマから有効になっています。
    disabledbooleanfalse範囲スライダを無効にするかどうかを定義します。
    idstringレンジスライダーの要素ID属性
    inputbooleanfalse有効にすると、input type="range" 要素を内部にもレンダリングします。
    inputIdstring入力要素のID属性
    namestring入力要素の "name "属性

    レンジスライダーのイベント

    EventDescription
    <Range> events
    rangeChangeレンジスライダーの値が変更されるとイベントが発生します。
    rangeChangedスライダーの値が変更された後、スライダーのノブが離されるとイベントが発生します。

    Examples

    import React, { useState } from 'react';
    import {
      Page,
      Navbar,
      BlockTitle,
      List,
      ListItem,
      ListItemCell,
      Icon,
      Range,
      Block,
    } from 'framework7-react';
    
    export default () => {
      const [priceMin, setPriceMin] = useState(200);
      const [priceMax, setPriceMax] = useState(200);
    
      const onPriceChange = (values) => {
        setPriceMin(values[0]);
        setPriceMax(values[1]);
      };
      return (
        
          
        <Page>
          <Navbar title="Range Slider"></Navbar>
    
          <BlockTitle>Volume</BlockTitle>
          <List simpleList>
            <ListItem>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon ios="f7:speaker_fill" aurora="f7:speaker_fill" md="material:volume_mute" />
              </ListItemCell>
              <ListItemCell className="flex-shrink-3">
                <Range min={0} max={100} step={1} value={10} />
              </ListItemCell>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon ios="f7:speaker_3_fill" aurora="f7:speaker_3_fill" md="material:volume_up" />
              </ListItemCell>
            </ListItem>
          </List>
    
          <BlockTitle>Brightness</BlockTitle>
          <List simpleList>
            <ListItem>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon ios="f7:sun_min" aurora="f7:sun_min" md="material:brightness_low" />
              </ListItemCell>
              <ListItemCell className="flex-shrink-3">
                <Range min={0} max={100} step={1} value={50} label={true} color="orange" />
              </ListItemCell>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon
                  ios="f7:sun_max_fill"
                  aurora="f7:sun_max_fill"
                  md="material:brightness_high"
                />
              </ListItemCell>
            </ListItem>
          </List>
    
          <BlockTitle className="display-flex justify-content-space-between">
            Price Filter{' '}
            <span>
              ${priceMin} - ${priceMax}
            </span>
          </BlockTitle>
          <List simpleList>
            <ListItem>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon
                  ios="f7:money_dollar_circle"
                  aurora="f7:money_dollar_circle"
                  md="material:attach_money"
                />
              </ListItemCell>
              <ListItemCell className="flex-shrink-3">
                <Range
                  min={0}
                  max={500}
                  step={1}
                  value={[priceMin, priceMax]}
                  label={true}
                  dual={true}
                  color="green"
                  onRangeChange={onPriceChange}
                />
              </ListItemCell>
              <ListItemCell className="width-auto flex-shrink-0">
                <Icon
                  ios="f7:money_dollar_circle_fill"
                  aurora="f7:money_dollar_circle_fill"
                  md="material:monetization_on"
                />
              </ListItemCell>
            </ListItem>
          </List>
    
          <BlockTitle>With Scale</BlockTitle>
          <Block strong>
            <Range
              min={0}
              max={100}
              label={true}
              step={5}
              value={25}
              scale={true}
              scaleSteps={5}
              scaleSubSteps={4}
            />
          </Block>
    
          <BlockTitle>Vertical</BlockTitle>
          <Block strong className="display-flex justify-content-center">
            <Range
              className="margin-right"
              style={{ height: '160px' }}
              vertical={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={25}
            />
            <Range
              className="margin-horizontal"
              style={{ height: '160px' }}
              vertical={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={50}
            />
            <Range
              className="margin-horizontal"
              style={{ height: '160px' }}
              vertical={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={75}
            />
            <Range
              className="margin-left"
              style={{ height: '160px' }}
              dual={true}
              vertical={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={[25, 75]}
            />
          </Block>
    
          <BlockTitle>Vertical Reversed</BlockTitle>
          <Block strong className="display-flex justify-content-center">
            <Range
              className="margin-right"
              color="red"
              style={{ height: '160px' }}
              vertical={true}
              verticalReversed={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={25}
            />
            <Range
              className="margin-horizontal"
              color="red"
              style={{ height: '160px' }}
              vertical={true}
              verticalReversed={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={50}
            />
            <Range
              className="margin-horizontal"
              color="red"
              style={{ height: '160px' }}
              vertical={true}
              verticalReversed={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={75}
            />
            <Range
              className="margin-left"
              color="red"
              style={{ height: '160px' }}
              dual={true}
              vertical={true}
              verticalReversed={true}
              min={0}
              max={100}
              label={true}
              step={1}
              value={[25, 75]}
            />
          </Block>
        </Page>
          
        
      );
    };