---
title: Number Field
description: A number input that allow users to input custom number entries with a keyboard.

link:
  doc: https://kobalte.dev/docs/core/components/number-field
  api: https://kobalte.dev/docs/core/components/number-field#api-reference
---

<ComponentPreview name="number-field-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/number-field-demo.tsx

```

</ComponentPreview>

## Installation

<ComponentInstallation>

<Step>

<StepItem>Copy and paste the following code into your project:</StepItem>

  <ComponentSourceTabs>

    ```tsx title="components/ui/number-field" file=<rootDir>/apps/docs/src/registry/ui/number-field.tsx

    ```

    ```tsx title="components/ui/number-field" file=<rootDir>/apps/unocss-playground/src/registry/ui/number-field.tsx

    ```

  </ComponentSourceTabs>

</Step>

</ComponentInstallation>

## Usage

```tsx
import {
  NumberField,
  NumberFieldDecrementTrigger,
  NumberFieldGroup,
  NumberFieldIncrementTrigger,
  NumberFieldInput,
  NumberFieldLabel,
} from "@components/ui/number-field"
```

```tsx
<NumberField>
  <NumberFieldLabel />
  <NumberFieldGroup>
    <NumberFieldInput />
    <NumberFieldDecrementTrigger />
    <NumberFieldIncrementTrigger />
  </NumberFieldGroup>
</NumberField>
```

## Examples

### With Error

<ComponentPreview name="number-field-error-demo">

```tsx file=<rootDir>/apps/docs/src/registry/examples/number-field-error-demo.tsx

```

</ComponentPreview>
