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
| Name | Description | Property | Type | Default | Allowed values |
|---|---|---|---|---|---|
compact | Shows just the exact field, retaining arrow-key stepping and arithmetic without separate step buttons. | compact | boolean | false | — |
disabled | Prevents typing, stepping and pointer or keyboard changes while keeping the value visible. | disabled | boolean | false | — |
label | Accessible name for the editing control. | label | string | Value | — |
max | Inclusive upper bound applied to every editing path. | max | number | 1000000 | — |
min | Inclusive lower bound applied to typing, arithmetic, stepping and external values. | min | number | -1000000 | — |
name | Optional form field name. | name | string | | — |
size | Shared field and button height. | size | keyword | md | sm, md, lg |
step | Positive increment used by arrows and step buttons; Shift multiplies it by ten. | step | number | 1 | — |
unit | One accepted unit, such as px, rem, ms or %. Bare numbers use this unit. No automatic unit conversion. | unit | string | | — |
value | Exact value. Arithmetic is calculated on Enter or blur; the resulting value includes unit. Invalid expressions stay visible and expose invalid state. | value | string | 0 | — |
Framework props
| Name | Type | Default | Allowed values |
|---|---|---|---|
compact | boolean | false | — |
disabled | boolean | false | — |
label | string | Value | — |
max | number | 1000000 | — |
min | number | -1000000 | — |
name | string | | — |
size | "sm" | "md" | "lg" | md | sm, md, lg |
step | number | 1 | — |
unit | string | | — |
value | string | 0 | — |
Events
| Name | Detail | Description |
|---|---|---|
change | object
| Emitted when a toggleable control changes checked state. |
input | object
| 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
| Token | Fallback |
|---|---|
--ui-space-1 | — |