Forms

ParameterField

Numeric parameter editor that distinguishes an inherited base value from a local override and makes reset state explicit.

import { ParameterField } from '@lostgradient/cinder';
formnumeric
01

Overview

Displays an inherited base parameter and an optional local override. Overrides can be reset to the base value and may carry Unsaved or Experimental badges.

Use the default output for a read-only summary, or provide a child snippet to render a NumberInput, Slider, or another numeric editor. The snippet receives the effective value, whether it is overridden, and a setOverride callback.

Usage

svelte
<script lang="ts">
  import { ParameterField } from '@lostgradient/cinder';
</script>

<ParameterField id="timeout" label="Timeout" base={30} unit="seconds" />

base is the effective value until override is supplied. The reset action clears the override and calls onOverrideChange(undefined); it never changes base. Use unsaved and experimental to annotate the value's status, not to change persistence or validation.

For a custom editor, the child snippet receives value, overridden, labelledBy, and setOverride. Apply labelledBy to the nested numeric control so the visible parameter label remains its accessible name. The host owns saving and error recovery: keep the override in place while a save fails and report the failure beside the control.

Live preview
Timeout
30 seconds
02

When to use

Use when
  • Editing a numeric setting that inherits a default but can be overridden locally.
Avoid when
  • Collecting an independent numeric value with no inheritance semantics — use number-input or slider.
03

Examples

Parameter override

Show an inherited value with a local override.

04

Props

Props for parameter-field
Name
Type
Default
Description
id required text Stable id used for label and output association.
label required text Visible parameter label.
base required number Inherited or default numeric value.
override bindable number Optional local numeric override. Bindable.
unit text Optional unit appended to the value and reset tooltip.
onOverrideChange (value: number | undefined) => void Called when the component's own setOverride (exposed to children as ParameterFieldEditorState.setOverride) accepts a value, or its built-in reset action runs—not only when either actually changes the override: calling setOverride with the value override already holds still notifies. setOverride rejecting a NaN/infinite value is the one case where nothing happens: no override change, no call here—see that function. Not called when a parent changes the bindable override prop programmatically—that update is not distinguishable here from the component's own writes.
unsaved boolean false Marks the current override as not yet persisted. Defaults to false.
experimental boolean false Marks the parameter as experimental. Defaults to false.
children snippet Optional custom numeric editor. Receives the effective value and override setter.