Skip to content
UI

Number Input

A numeric input component with increment and decrement controls.

<script lang="ts" setup>
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root>
    <NumberInput.Label>
      Label:
      <NumberInput.ValueText />
    </NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Scrubber />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import type { UseNumberInputProps } from '@destyler-ui/react'
import { NumberInput } from '@destyler-ui/react'

export function Basic(props: UseNumberInputProps) {
  return (
    <NumberInput.Root {...props}>
      <NumberInput.Label>
        Label:
        <NumberInput.ValueText />
      </NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Scrubber />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function Basic() {
  return (
    <NumberInput.Root>
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script module lang="ts">
  import type { NumberInputRootProps } from '@destyler-ui/svelte'

  export interface BasicProps extends NumberInputRootProps {}
</script>

<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'

  const props: BasicProps = $props()
</script>

<NumberInput.Root {...props}>
  <NumberInput.Label>
    Label:
    <NumberInput.ValueText />
  </NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Scrubber />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>
<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>
<template>
<NumberInput.Root>
<NumberInput.Label />
<NumberInput.ValueText />
<NumberInput.Control>
<NumberInput.DecrementTrigger />
<NumberInput.Input />
<NumberInput.IncrementTrigger />
</NumberInput.Control>
<NumberInput.Scrubber />
</NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'
export default function Basic() {
return (
<NumberInput.Root>
<NumberInput.Label />
<NumberInput.ValueText />
<NumberInput.Control>
<NumberInput.DecrementTrigger />
<NumberInput.Input />
<NumberInput.IncrementTrigger />
</NumberInput.Control>
<NumberInput.Scrubber />
</NumberInput.Root>
)
}
import { NumberInput } from '@destyler-ui/solid'
export default function Basic() {
return (
<NumberInput.Root>
<NumberInput.Label />
<NumberInput.ValueText />
<NumberInput.Control>
<NumberInput.DecrementTrigger />
<NumberInput.Input />
<NumberInput.IncrementTrigger />
</NumberInput.Control>
<NumberInput.Scrubber />
</NumberInput.Root>
)
}
<script lang="ts">
import { NumberInput } from '@destyler-ui/svelte'
</script>
<NumberInput.Root>
<NumberInput.Label>
Quantity: <NumberInput.ValueText />
</NumberInput.Label>
<NumberInput.Input />
<NumberInput.Scrubber />
<NumberInput.Control>
<NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
<NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
</NumberInput.Control>
</NumberInput.Root>
<script lang="ts" setup>
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root>
    <NumberInput.Label>
      Label:
      <NumberInput.ValueText />
    </NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Scrubber />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import type { UseNumberInputProps } from '@destyler-ui/react'
import { NumberInput } from '@destyler-ui/react'

export function Basic(props: UseNumberInputProps) {
  return (
    <NumberInput.Root {...props}>
      <NumberInput.Label>
        Label:
        <NumberInput.ValueText />
      </NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Scrubber />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function Basic() {
  return (
    <NumberInput.Root>
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script module lang="ts">
  import type { NumberInputRootProps } from '@destyler-ui/svelte'

  export interface BasicProps extends NumberInputRootProps {}
</script>

<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'

  const props: BasicProps = $props()
</script>

<NumberInput.Root {...props}>
  <NumberInput.Label>
    Label:
    <NumberInput.ValueText />
  </NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Scrubber />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Set minimum and maximum value constraints.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root :min="0" :max="10">
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function MinMax() {
  return (
    <NumberInput.Root min={0} max={10}>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function MinMax() {
  return (
    <NumberInput.Root min={0} max={10}>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root min={0} max={10}>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Control the number of decimal places.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root :formatOptions="{ minimumFractionDigits: 2, maximumFractionDigits: 3 }" model-value="1.00">
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function FractionDigits() {
  return (
    <NumberInput.Root
      formatOptions={{ minimumFractionDigits: 2, maximumFractionDigits: 3 }}
      defaultValue="1.00"
    >
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function FractionDigits() {
  return (
    <NumberInput.Root
      formatOptions={{ minimumFractionDigits: 2, maximumFractionDigits: 4 }}
      value="1.00"
    >
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root
  formatOptions={{ minimumFractionDigits: 2, maximumFractionDigits: 3 }}
  defaultValue="1.00"
>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Display formatted numeric values with locale support.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root :formatOptions="{ style: 'currency', currency: 'USD' }">
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function Formatted() {
  return (
    <NumberInput.Root formatOptions={{ style: 'currency', currency: 'USD' }}>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function Formatted() {
  return (
    <NumberInput.Root
      formatOptions={{
        style: 'currency',
        currency: 'USD',
      }}
    >
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root formatOptions={{ style: 'currency', currency: 'USD' }}>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Use number input in a form context.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root name="quantity">
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function FormUsage() {
  return (
    <NumberInput.Root name="quantity">
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function FormUsage() {
  return (
    <NumberInput.Root name="quantity">
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root name="quantity">
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Enable value changes via mouse wheel.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root allowMouseWheel>
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function MouseWheel() {
  return (
    <NumberInput.Root allowMouseWheel>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function MouseWheel() {
  return (
    <NumberInput.Root allowMouseWheel>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root allowMouseWheel>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Allow values outside the min/max range.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root :clampValueOnBlur="false">
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function NoClamp() {
  return (
    <NumberInput.Root clampValueOnBlur={false}>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function NoClamp() {
  return (
    <NumberInput.Root clampValueOnBlur={false}>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root clampValueOnBlur={false}>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Use the scrubber for drag-based value changes.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root>
    <NumberInput.Scrubber />
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function Scrubber() {
  return (
    <NumberInput.Root>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function Scrubber() {
  return (
    <NumberInput.Root>
      <NumberInput.Scrubber />
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root>
  <NumberInput.Scrubber />
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Use render function for custom rendering.

<script setup lang="ts">
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <NumberInput.Root>
    <NumberInput.Scrubber />
    <NumberInput.Context v-slot="numberInput">
      <NumberInput.Label>Label {{ numberInput.valueAsNumber }}</NumberInput.Label>
    </NumberInput.Context>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
</template>
import { NumberInput } from '@destyler-ui/react'

export function RenderFn() {
  return (
    <NumberInput.Root>
      <NumberInput.Scrubber />
      <NumberInput.Context>
        {numberInput => (
          <NumberInput.Label>Label {numberInput.valueAsNumber}</NumberInput.Label>
        )}
      </NumberInput.Context>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
import { NumberInput } from '@destyler-ui/solid/number-input'

export function RenderFn() {
  return (
    <NumberInput.Root>
      <NumberInput.Scrubber />
      <NumberInput.Context>
        {context => <NumberInput.Label>Label {context().valueAsNumber}</NumberInput.Label>}
      </NumberInput.Context>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
  )
}
<script lang="ts">
  import { NumberInput } from '@destyler-ui/svelte'
</script>

<NumberInput.Root>
  <NumberInput.Scrubber />
  <NumberInput.Context>
    {#snippet render(numberInput)}
      <NumberInput.Label>Label {numberInput().valueAsNumber}</NumberInput.Label>
    {/snippet}
  </NumberInput.Context>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.Root>

Combine with a form field for validation and labeling.

<script setup lang="ts">
import { Field } from '@destyler-ui/vue'
import { NumberInput } from '@destyler-ui/vue'
</script>

<template>
  <Field.Root>
    <NumberInput.Root>
      <NumberInput.Label>Label</NumberInput.Label>
      <NumberInput.Input />
      <NumberInput.Control>
        <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
        <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
      </NumberInput.Control>
    </NumberInput.Root>
    <Field.HelperText>Additional Info</Field.HelperText>
    <Field.ErrorText>Error Info</Field.ErrorText>
  </Field.Root>
</template>
import type { UseNumberInputProps } from '@destyler-ui/react'
import { Field } from '@destyler-ui/react'
import { NumberInput } from '@destyler-ui/react'

export interface WithFieldProps extends UseNumberInputProps {
  invalid?: boolean
}

export function WithField(props: WithFieldProps) {
  const { invalid, ...numberInputProps } = props

  return (
    <Field.Root invalid={invalid}>
      <NumberInput.Root {...numberInputProps}>
        <NumberInput.Label>Label</NumberInput.Label>
        <NumberInput.Input />
        <NumberInput.Control>
          <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
          <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
        </NumberInput.Control>
      </NumberInput.Root>
      <Field.HelperText>Additional Info</Field.HelperText>
      <Field.ErrorText>Error Info</Field.ErrorText>
    </Field.Root>
  )
}
import { Field } from '@destyler-ui/solid/field'
import { NumberInput } from '@destyler-ui/solid/number-input'

export function WithField(props: Field.RootProps) {
  return (
    <Field.Root {...props}>
      <NumberInput.Root>
        <NumberInput.Label>Label</NumberInput.Label>
        <NumberInput.Input />
        <NumberInput.Control>
          <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
          <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
        </NumberInput.Control>
      </NumberInput.Root>
      <Field.HelperText>Additional Info</Field.HelperText>
      <Field.ErrorText>Error Info</Field.ErrorText>
    </Field.Root>
  )
}
<script module lang="ts">
  import type { NumberInputRootProps } from '@destyler-ui/svelte'

  export interface WithFieldProps extends NumberInputRootProps {}
</script>

<script lang="ts">
  import { Field } from '@destyler-ui/svelte'
  import { NumberInput } from '@destyler-ui/svelte'

  const {
    invalid,
    disabled,
    readOnly,
    required,
    ...numberInputProps
  }: WithFieldProps = $props()
</script>

<Field.Root {invalid} {disabled} {readOnly} {required}>
  <NumberInput.Root {...numberInputProps}>
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.Root>
  <Field.HelperText>Additional Info</Field.HelperText>
  <Field.ErrorText>Error Info</Field.ErrorText>
</Field.Root>
<script setup lang="ts">
import { NumberInput, useNumberInput } from '@destyler-ui/vue'

const numberInput = useNumberInput()
</script>

<template>
  <button @click="numberInput.focus()">Focus</button>

  <NumberInput.RootProvider :value="numberInput">
    <NumberInput.Label>Label</NumberInput.Label>
    <NumberInput.Input />
    <NumberInput.Control>
      <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
      <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
    </NumberInput.Control>
  </NumberInput.RootProvider>
</template>
import { NumberInput, useNumberInput } from '@destyler-ui/react'

export function RootProvider() {
  const numberInput = useNumberInput()

  return (
    <>
      <button onClick={() => numberInput.focus()}>Focus</button>

      <NumberInput.RootProvider value={numberInput}>
        <NumberInput.Label>Label</NumberInput.Label>
        <NumberInput.Input />
        <NumberInput.Control>
          <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
          <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
        </NumberInput.Control>
      </NumberInput.RootProvider>
    </>
  )
}
import { NumberInput, useNumberInput } from '@destyler-ui/solid/number-input'

export function RootProvider() {
  const numberInput = useNumberInput()

  return (
    <>
      <button onClick={() => numberInput().focus()}>Focus</button>

      <NumberInput.RootProvider value={numberInput}>
        <NumberInput.Label>Label</NumberInput.Label>
        <NumberInput.Input />
        <NumberInput.Control>
          <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
          <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
        </NumberInput.Control>
      </NumberInput.RootProvider>
    </>
  )
}
<script lang="ts">
  import { NumberInput, useNumberInput } from '@destyler-ui/svelte'

  const id = $props.id()
  const numberInput = useNumberInput({ id })
</script>

<button type="button" onclick={() => numberInput().focus()}>Focus</button>
<NumberInput.RootProvider value={numberInput}>
  <NumberInput.Label>Label</NumberInput.Label>
  <NumberInput.Input />
  <NumberInput.Control>
    <NumberInput.DecrementTrigger>-1</NumberInput.DecrementTrigger>
    <NumberInput.IncrementTrigger>+1</NumberInput.IncrementTrigger>
  </NumberInput.Control>
</NumberInput.RootProvider>

Root

PropDefaultType
allowMouseWheelfalse | true

Whether to allow mouse wheel to change the value

allowOverflowtruefalse | true

Whether to allow the value overflow the min/max range

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

clampValueOnBlurtruefalse | true

Whether to clamp the value when the input loses focus (blur)

defaultValuestring

The initial value of the number input when it is first rendered. Use when you do not need to control the state of the number input.

disabledfalse | true

Whether the number input is disabled.

focusInputOnChangetruefalse | true

Whether to focus input when the value changes

formstring

The associate form of the input element.

formatOptionsIntl.NumberFormatOptions

The options to pass to the `Intl.NumberFormat` constructor

idstring

The unique identifier of the machine.

idsPartial<{ root: string; label: string; input: string; incrementTrigger: string; decrementTrigger: string; scrubber: string; }>

The ids of the elements in the number input. Useful for composition.

inputMode"decimal""text" | "tel" | "numeric" | "decimal"

Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices

invalidfalse | true

Whether the number input value is invalid.

locale"en-US"string

The current locale. Based on the BCP 47 definition.

maxNumber.MAX_SAFE_INTEGERnumber

The maximum value of the number input

minNumber.MIN_SAFE_INTEGERnumber

The minimum value of the number input

modelValuestring
namestring

The name attribute of the number input. Useful for form submission.

pattern"[0-9]*(.[0-9]+)?"string

The pattern used to check the <input> element's value against

readOnlyfalse | true

Whether the number input is readonly

requiredfalse | true

Whether the number input is required

spinOnPresstruefalse | true

Whether to spin the value when the increment/decrement button is pressed

step1number

The amount to increment or decrement the value by

translationsnumberInput.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

EmitEvent
focusChange[details: FocusChangeDetails]

Function invoked when the number input is focused

update:modelValue[value: string]

The callback fired when the model value changes.

valueChange[details: ValueChangeDetails]

Function invoked when the value changes

valueInvalid[details: ValueInvalidDetails]

Function invoked when the value overflows or underflows the min/max range

Context

No serializable props or emits are declared for this part.

Control

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

DecrementTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

IncrementTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

RootProvider

PropDefaultType
value*MachineApi<PropTypes>
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Scrubber

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ValueText

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
allowMouseWheelfalse | true

Whether to allow mouse wheel to change the value

allowOverflowtruefalse | true

Whether to allow the value overflow the min/max range

asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

clampValueOnBlurtruefalse | true

Whether to clamp the value when the input loses focus (blur)

defaultValuestring

The initial value of the number input when it is first rendered. Use when you do not need to control the state of the number input.

disabledfalse | true

Whether the number input is disabled.

focusInputOnChangetruefalse | true

Whether to focus input when the value changes

formstring

The associate form of the input element.

formatOptionsIntl.NumberFormatOptions

The options to pass to the `Intl.NumberFormat` constructor

idstring

The unique identifier of the machine.

idsPartial<{ root: string; label: string; input: string; incrementTrigger: string; decrementTrigger: string; scrubber: string; }>

The ids of the elements in the number input. Useful for composition.

inputMode"decimal""text" | "tel" | "numeric" | "decimal"

Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices

invalidfalse | true

Whether the number input value is invalid.

locale"en-US"string

The current locale. Based on the BCP 47 definition.

maxNumber.MAX_SAFE_INTEGERnumber

The maximum value of the number input

minNumber.MIN_SAFE_INTEGERnumber

The minimum value of the number input

namestring

The name attribute of the number input. Useful for form submission.

onFocusChange(details: numberInput.FocusChangeDetails) => void

Function invoked when the number input is focused

onValueChange(details: numberInput.ValueChangeDetails) => void

Function invoked when the value changes

onValueInvalid(details: numberInput.ValueInvalidDetails) => void

Function invoked when the value overflows or underflows the min/max range

pattern"[0-9]*(.[0-9]+)?"string

The pattern used to check the <input> element's value against

readOnlyfalse | true

Whether the number input is readonly

requiredfalse | true

Whether the number input is required

spinOnPresstruefalse | true

Whether to spin the value when the increment/decrement button is pressed

step1number

The amount to increment or decrement the value by

translationsnumberInput.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

valuestring

The value of the input

Context

PropDefaultType
children*(context: UseNumberInputContext) => ReactNode

Control

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

DecrementTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

IncrementTrigger

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Provider

No serializable props or emits are declared for this part.

RootProvider

PropDefaultType
value*UseNumberInputReturn
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Scrubber

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

ValueText

PropDefaultType
asChildfalse | true

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
allowMouseWheelfalse | true

Whether to allow mouse wheel to change the value

allowOverflowtruefalse | true

Whether to allow the value overflow the min/max range

asChild(props: (userProps?: solid_js109.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

clampValueOnBlurtruefalse | true

Whether to clamp the value when the input loses focus (blur)

defaultValuestring

The initial value of the number input when it is first rendered. Use when you do not need to control the state of the number input.

disabledfalse | true

Whether the number input is disabled.

focusInputOnChangetruefalse | true

Whether to focus input when the value changes

formstring

The associate form of the input element.

formatOptionsIntl.NumberFormatOptions

The options to pass to the `Intl.NumberFormat` constructor

idstring

The unique identifier of the machine.

idsPartial<{ root: string; label: string; input: string; incrementTrigger: string; decrementTrigger: string; scrubber: string; }>

The ids of the elements in the number input. Useful for composition.

inputMode"decimal""text" | "tel" | "numeric" | "decimal"

Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices

invalidfalse | true

Whether the number input value is invalid.

locale"en-US"string

The current locale. Based on the BCP 47 definition.

maxNumber.MAX_SAFE_INTEGERnumber

The maximum value of the number input

minNumber.MIN_SAFE_INTEGERnumber

The minimum value of the number input

namestring

The name attribute of the number input. Useful for form submission.

onFocusChange(details: FocusChangeDetails) => void

Function invoked when the number input is focused

onValueChange(details: ValueChangeDetails) => void

Function invoked when the value changes

onValueInvalid(details: ValueInvalidDetails) => void

Function invoked when the value overflows or underflows the min/max range

pattern"[0-9]*(.[0-9]+)?"string

The pattern used to check the <input> element's value against

readOnlyfalse | true

Whether the number input is readonly

requiredfalse | true

Whether the number input is required

spinOnPresstruefalse | true

Whether to spin the value when the increment/decrement button is pressed

step1number

The amount to increment or decrement the value by

translationsnumberInput.IntlTranslations

Specifies the localized strings that identifies the accessibility elements and their states

valuestring

The value of the input

Context

PropDefaultType
children*(context: UseNumberInputContext) => Element

Control

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

DecrementTrigger

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

IncrementTrigger

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.ButtonHTMLAttributes<HTMLButtonElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Input

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.InputHTMLAttributes<HTMLInputElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Label

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.LabelHTMLAttributes<HTMLLabelElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Provider

No serializable props or emits are declared for this part.

RootProvider

PropDefaultType
value*UseNumberInputReturn
asChild(props: (userProps?: solid_js109.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Scrubber

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.HTMLAttributes<HTMLDivElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

ValueText

PropDefaultType
asChild(props: (userProps?: solid_js109.JSX.HTMLAttributes<HTMLSpanElement> | undefined) => JSX.HTMLAttributes<any>) => JSX.Element

Use the provided child element as the default rendered element, combining their props and behavior.

Root

PropDefaultType
allowMouseWheelfalse | true

Whether to allow mouse wheel to change the value

allowOverflowtruefalse | true

Whether to allow the value overflow the min/max range

asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined
clampValueOnBlurtruefalse | true

Whether to clamp the value when the input loses focus (blur)

defaultValuestring
disabledfalse | true

Whether the number input is disabled.

focusInputOnChangetruefalse | true

Whether to focus input when the value changes

formstring

The associate form of the input element.

formatOptionsIntl.NumberFormatOptions

The options to pass to the `Intl.NumberFormat` constructor

idstring

A stable id for the number input. Svelte hooks cannot call `$props.id()`. Components should pass the id generated at the component's top level; `NumberInput.Root` does this automatically.

idsPartial<{ root: string; label: string; input: string; incrementTrigger: string; decrementTrigger: string; scrubber: string; }>

The ids of the elements in the number input. Useful for composition.

inputMode"decimal""text" | "tel" | "numeric" | "decimal"

Hints at the type of data that might be entered by the user. It also determines the type of keyboard shown to the user on mobile devices

invalidfalse | true

Whether the number input value is invalid.

locale"en-US"string

The current locale. Based on the BCP 47 definition.

maxNumber.MAX_SAFE_INTEGERnumber

The maximum value of the number input

minNumber.MIN_SAFE_INTEGERnumber

The minimum value of the number input

namestring

The name attribute of the number input. Useful for form submission.

onFocusChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").NumberInputFocusChangeDetails) => void

Function invoked when the number input is focused

onValueChange(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").NumberInputValueChangeDetails) => void

Function invoked when the value changes

onValueInvalid(details: import("/home/runner/work/ui/ui/packages/svelte/dist/index").NumberInputValueInvalidDetails) => void

Function invoked when the value overflows or underflows the min/max range

pattern"[0-9]*(.[0-9]+)?"string

The pattern used to check the <input> element's value against

readOnlyfalse | true

Whether the number input is readonly

requiredfalse | true

Whether the number input is required

spinOnPresstruefalse | true

Whether to spin the value when the increment/decrement button is pressed

step1number

The amount to increment or decrement the value by

translationsIntlTranslations | undefined

Specifies the localized strings that identifies the accessibility elements and their states

valuestring

The value of the input

Context

PropDefaultType
render*Snippet<[UseNumberInputContext]>

Control

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

DecrementTrigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined

IncrementTrigger

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"button">]>
childrenSnippet<[]> | undefined

Input

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"input">]>
childrenSnippet<[]> | undefined

Label

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"label">]>
childrenSnippet<[]> | undefined

Provider

No serializable props or emits are declared for this part.

RootProvider

PropDefaultType
value*UseNumberInputReturn
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

Scrubber

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"div">]>
childrenSnippet<[]> | undefined

ValueText

PropDefaultType
asChildimport("svelte").Snippet<[import("/home/runner/work/ui/ui/packages/svelte/dist/types").PropsFn<"span">]>
childrenSnippet<[]> | undefined