Parameter Slider
An inline range slider with a live value readout for tuning local generation parameters — temperature, top-k, top-p, max tokens, GPU layers, KV-cache.
Parameter Slider
The Parameter Slider is an inline range slider with a live value readout for reversible adjustment of a local generation parameter — temperature, top-k, top-p, max tokens, GPU layers, KV-cache quant. It is fully controlled, and the emitted value feeds straight into your next local generation call.
It is built on the shadcn/ui Slider primitive, so it inherits your theme. Wire value / onChange into the options you pass to useGenerateText() or useChat().
When to use it: a settings panel or chat composer where the user tunes how the local model generates.
Preview
Installation
pnpm dlx shadcn@latest add @localmode/ui/input-controls/parameter-slidernpx shadcn@latest add @localmode/ui/input-controls/parameter-slideryarn dlx shadcn@latest add @localmode/ui/input-controls/parameter-sliderbunx --bun shadcn@latest add @localmode/ui/input-controls/parameter-sliderDependencies
- Data source: renders the controlled
valueyou pass and emitsonChange— works with any backend. Recommended LocalMode producer: feed the value intouseGenerateText/useChatoptions (optional). radix-ui— the underlying slider primitiveclsx+tailwind-merge— via the sharedcn()util (installed automatically)
Files installed
parameter-slider.tsx— the componentui/slider.tsx— the shadcn/ui slider primitive (registry dependency)lib/utils.ts— thecn()helper (if not already present)
Props
ParameterSlider
Prop
Type
Examples
Tune temperature for useGenerateText
import { useState } from 'react';
import { useGenerateText } from '@localmode/react';
import { ParameterSlider } from '@/components/parameter-slider';
export function GenSettings({ model }) {
const [temp, setTemp] = useState(0.7);
const { execute } = useGenerateText({ model, temperature: temp });
return (
<ParameterSlider
label="Temperature"
value={temp}
onChange={setTemp}
min={0}
max={2}
step={0.1}
precision={1}
/>
);
}Integer parameter with a unit
<ParameterSlider label="Max tokens" value={maxTokens} onChange={setMaxTokens} min={16} max={2048} step={16} unit="tokens" />Customization
Set precision for decimal readouts (temperature, top-p) and unit for a suffix. The slider track and thumb use shadcn/ui CSS variables (bg-primary, border-primary), so the control matches your theme. Because you own the file, you can add tick marks or snap-to presets by editing parameter-slider.tsx.
Accessibility
The control renders the Radix Slider primitive directly (not a wrapped <Slider>) because Radix ignores aria-label on the Root — so the accessible name and formatted readout must land on the focusable Thumb, the element that actually carries role="slider". The Thumb takes its aria-label from label and an aria-valuetext formatted with precision + unit (e.g. "0.7", "512 tokens"), so screen readers announce the parameter name and a human-readable value instead of the raw number, and getByRole('slider', { name: label }) resolves it uniquely.
Text Processing Panel
A two-column input→output NLP shell — labeled textarea + word count + optional Char Limit Indicator, a result pane with copy, and a run/cancel/clear toolbar.
Slash Command Palette
A "/"-triggered command palette over a local tool/command list — name, category, description, and icon — to layer onto a PromptInput Tools slot.