以下のコンポーネントが含まれています
Range (レンジ)
名前 | 型 | デフォルト | 説明 |
---|---|---|---|
colors (カラー) | object (オブジェクト) | Tailwind CSSカラースタイルクラスを持つオブジェクト | |
colors.thumbBgIos | string (文字列) | 'range-thumb:bg-white' | |
colors.thumbBgMaterial | string (文字列) | 'range-thumb:bg-md-light-primary dark:range-thumb:bg-md-dark-primary' | |
colors.valueBgIos | string (文字列) | 'bg-primary' | |
colors.valueBgMaterial | string (文字列) | 'bg-md-light-primary dark:bg-md-dark-primary' | |
component (コンポーネント) | string (文字列) | 'div' | コンポーネントのHTML要素 |
defaultValue (デフォルト値) | any (任意) | 非制御コンポーネントの場合のレンジ値 | |
disabled (無効) | boolean (真偽値) | false | レンジ入力が無効かどうかを定義します |
inputId (入力ID) | string (文字列) | レンジ入力のID属性 | |
max (最大値) | number (数値) | 100 | レンジの最大値 |
min (最小値) | number (数値) | 0 | レンジの最小値 |
name (名前) | string (文字列) | レンジ入力の名前 | |
readOnly (読み取り専用) | boolean (真偽値) | false | レンジ入力が読み取り専用かどうかを定義します |
step (ステップ) | number (数値) | 1 | レンジのステップ |
value (値) | any (任意) | レンジの値 | |
onBlur | function(e) |
| |
onChange | function(e) |
| |
onFocus | function(e) |
| |
onInput | function(e) |
|
import React, { useState } from 'react';import {Page,Navbar,NavbarBackLink,BlockTitle,BlockHeader,List,ListItem,Range,} from 'konsta/react';export default function RangeSliderPage() {const [volume, setVolume] = useState(50);const [price, setPrice] = useState(150);const [red, setRed] = useState(100);const [green, setGreen] = useState(50);const [blue, setBlue] = useState(75);return (<Page><Navbartitle="Range Slider"/><BlockTitle>Volume: {volume}</BlockTitle><BlockHeader>From 0 to 100 with step 10</BlockHeader><List strong insetMaterial outlineIos><ListIteminnerClassName="flex space-x-4 rtl:space-x-reverse"innerChildren={<><span>0</span><Rangevalue={volume}step={10}onChange={(e) => setVolume(e.target.value)}/><span>100</span></>}/></List><BlockTitle>Price: ${price}</BlockTitle><BlockHeader>From 0 to 1000 with step 1</BlockHeader><List strong insetMaterial outlineIos><ListIteminnerClassName="flex space-x-4 rtl:space-x-reverse"innerChildren={<><span>$0</span><Rangevalue={price}step={1}min={0}max={1000}onChange={(e) => setPrice(e.target.value)}/><span>$1000</span></>}/></List><BlockTitle>Color: rgb({red}, {green}, {blue})</BlockTitle><List strong insetMaterial outlineIos><ListIteminnerChildren={<RangeclassName="k-color-brand-red"value={red}step={1}min={0}max={255}onChange={(e) => setRed(e.target.value)}/>}/><ListIteminnerChildren={<RangeclassName="k-color-brand-green"value={green}step={1}min={0}max={255}onChange={(e) => setGreen(e.target.value)}/>}/><ListIteminnerChildren={<RangeclassName="k-color-brand-blue"value={blue}step={1}min={0}max={255}onChange={(e) => setBlue(e.target.value)}/>}/></List></Page>);}