Number Input

Bounded exact number and unit editing with safe arithmetic, stepping and keyboard controls.

Exact and visual editing

Bounded exact number and unit editing with safe arithmetic, stepping and keyboard controls.

Code

<link
  rel="component"
  href="@threadlabs/looma/components/ui-number-input/ui-number-input.html"
>

<ui-number-input
  label="Frodo’s desk spacing"
  value="16px"
  unit="px"
  min="8"
  max="40"
  step="1"
></ui-number-input>
<script setup>
  import { UiNumberInput } from "@threadlabs/looma";
</script>

<template>
  <UiNumberInput
    label="Frodo’s desk spacing"
    value="16px"
    unit="px"
    :min="8"
    :max="40"
    :step="1"
  />
</template>
import { UiNumberInput } from "@threadlabs/looma";

export default function Example() {
  return <UiNumberInput
    label="Frodo’s desk spacing"
    value="16px"
    unit="px"
    min={8}
    max={40}
    step={1}
  />;
}
/** @jsxImportSource preact */
import { UiNumberInput } from "@threadlabs/looma";

export default function Example() {
  return <UiNumberInput
    label="Frodo’s desk spacing"
    value="16px"
    unit="px"
    min={8}
    max={40}
    step={1}
  />;
}
<script>
  import { UiNumberInput } from "@threadlabs/looma";
</script>

<UiNumberInput
  label="Frodo’s desk spacing"
  value="16px"
  unit="px"
  min={8}
  max={40}
  step={1}
/>
import { Component } from "@angular/core";
import { UiNumberInput } from "@threadlabs/looma";

@Component({
  selector: "example-view",
  standalone: true,
  imports: [UiNumberInput],
  template: `
    <span
      ui-number-input
      [label]="'Frodo’s desk spacing'"
      [value]="'16px'"
      [unit]="'px'"
      [min]="8"
      [max]="40"
      [step]="1"
    ></span>
  `,
})
export default class Example {}

API

Package: @threadlabs/looma · Native root: span

Attributes

NameDescriptionPropertyTypeDefaultAllowed values
compactShows just the exact field, retaining arrow-key stepping and arithmetic without separate step buttons.compactbooleanfalse—
disabledPrevents typing, stepping and pointer or keyboard changes while keeping the value visible.disabledbooleanfalse—
labelAccessible name for the editing control.labelstringValue—
maxInclusive upper bound applied to every editing path.maxnumber1000000—
minInclusive lower bound applied to typing, arithmetic, stepping and external values.minnumber-1000000—
nameOptional form field name.namestring—
sizeShared field and button height.sizekeywordmdsm, md, lg
stepPositive increment used by arrows and step buttons; Shift multiplies it by ten.stepnumber1—
unitOne accepted unit, such as px, rem, ms or %. Bare numbers use this unit. No automatic unit conversion.unitstring—
valueExact value. Arithmetic is calculated on Enter or blur; the resulting value includes unit. Invalid expressions stay visible and expose invalid state.valuestring0—

Framework props

NameTypeDefaultAllowed values
compactbooleanfalse—
disabledbooleanfalse—
labelstringValue—
maxnumber1000000—
minnumber-1000000—
namestring—
size"sm" | "md" | "lg"mdsm, md, lg
stepnumber1—
unitstring—
valuestring0—

Events

NameDetailDescription
changeobject
  • value: string (required)
Emitted when a toggleable control changes checked state.
inputobject
  • value: string (required)
Emitted with the declared detail payload.

Slots

No slots.

Design tokens

Set shared theme properties on a theme boundary. Component hooks apply only to their owning component.

Component tokens

No component tokens.

Shared tokens

TokenFallback
--ui-space-1—