Champ numérique d’inspecteur : faites glisser son libellé, son icône ou sa valeur latéralement pour ajuster, avec verrouillage du pointeur facultatif, accélération selon la vitesse, un badge qui compte la variation et un rail qui montre où se situe la valeur dans sa plage. Il reste un vrai champ texte : tapez un nombre ou une expression (« 12*2 », « +=4 »), avancez par pas avec les flèches, et une unité s’affiche en suffixe.
Catégorie
Formulaires
Type
Web Component (<mv-scrub-field>)
Statut
bêta
Keywords
scrub, number, inspector, spinbutton, pointer-lock, expression, unit, form-associated, editor
When to use
A design-tool inspector needs compact numeric fields for size, spacing or opacity that can be dragged
Users type expressions like 12*2 or +=4 and see a unit suffix such as px or ms
Many numeric properties must fit in a dense side panel
Avoid when
The form targets general users who expect visible - and + buttons → use Number Field instead
Several linked values like X/Y or width/height are edited together → use Vector Field instead
It is a shopping quantity with stock limits → use Quantity instead
Agent IA avec le serveur MCP de Marvelous UI : install_components({ slugs: ["scrub-field"], target_dir: "<absolute path>/src/marvelous", framework: "react" }).
Generated parts (the rail appears when both min and max are set).
mv-scrub-field-cursor
Virtual cursor appended to <body> only while the pointer is locked.
CSS variables
Name
Default
Description
--mv-scrub-field-width
6.5rem
Width.
--mv-scrub-field-height
var(--mv-control-sm)
Height.
--mv-scrub-field-bg
Field background.
--mv-scrub-field-radius
var(--mv-radius-sm)
Radius.
Accessibility
The value is a real text input with role="spinbutton", aria-valuenow/min/max and an aria-valuetext that includes the unit. It is named by its label (<label for>), aria-label or an external <label>. Keyboard: ↑/↓ (Shift ×10, Alt ×0.1), PageUp/PageDown, Home/End when not typing, Enter to commit, Escape to cancel an edit or a drag. An invalid expression is flagged with aria-invalid. The system cursor is never hidden unless the browser grants pointer lock, when a virtual cursor replaces it. Dragging the value itself is for mouse and pen; on touch, drag the handle and tap the value to type. Motion (step nudge, error shake) is skipped under reduced motion, and forced-colors mode uses system colors for the frame, rail, badge and cursor.