Mobilens English

控件 · 输入

数量步进器

所有状态

何时出现
行为规则

    用法

    import { useState } from 'react';
    import { Stepper } from '@/components/mobilens/Stepper';
    
    export function TicketQuantity() {
      const [quantity, setQuantity] = useState(1);
      return (
        <Stepper value={quantity} onValueChange={setQuantity} min={0} max={6}
          decreaseLabel="Remove one ticket" increaseLabel="Add one ticket" />
      );
    }
    

    API

    参数类型默认值说明
    value number – Controlled numeric amount.
    onValueChange (value: number) => void – Receives the bounded amount after a press.
    min? number 0 Lowest allowed amount and origin for the step intervals.
    max? number 99 Highest allowed amount, including a partial last step.
    step? number 1 Positive interval between adjacent values.
    decreaseLabel string – Accessible name of the minus button, including what it adjusts.
    increaseLabel string – Accessible name of the plus button, including what it adjusts.
    disabled? boolean false Prevent both changes while preserving the current amount.