/*!
MIT License
Copyright (c) 2026 Jaison
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {RangeSlider} from '@bld8/ui';
export default function BudgetExample(){
const [budget,setBudget]=useState<[number,number]>([20,80]),[committed,setCommitted]=useState('');
return <div><RangeSlider label="Monthly budget" name="budget" value={budget} onValueChange={setBudget}
onValueCommitted={range=>setCommitted(range.join(' to '))} min={0} max={100} step={5} minGap={10}
thumbLabels={['Minimum budget','Maximum budget']} hint="Keep at least 10 between the lower and upper values."/>
<p role="status">{committed?'Committed '+committed:'Adjust either end of the range.'}</p>
</div>;
}
/*!
MIT License
Copyright (c) 2026 Jaison
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import '@bld8/ui/styles.css';
import {useState} from 'react';
import {Button,RangeSlider} from '@bld8/ui';
export default function RetentionExample(){
const [status,setStatus]=useState('');
return <form onSubmit={event=>{event.preventDefault();setStatus('Retention values: '+new FormData(event.currentTarget).getAll('retention').join(', '));}}>
<RangeSlider label="Retention window" name="retention" defaultValue={[15,45]} min={0} max={60} step={5} minGap={10}
thumbLabels={['Earliest retention','Latest retention']} hint="Keep a minimum interval of ten."/>
<RangeSlider label="Locked example range" defaultValue={[20,40]} disabled/>
<Button type="submit">Read retention values</Button><Button type="reset" variant="secondary">Reset retention example</Button>
<p role="status">{status}</p>
</form>;
}
In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.
API & behaviour
A controlled or uncontrolled numeric pair. Two labelled native range inputs support keyboard and form submission. minGap is expressed in value units and rounded up to whole steps. Clamp is the default collision rule; push optionally moves the other thumb during pointer interaction. Values stay ordered. onValueCommitted reports completed interactions. Disabled, hint/error, refs and native form reset are supported; currency and business validation belong to the host.
RangeSlider
RangeSlider public properties
Prop
Type
Default
labelRequired
string
—
className
string | undefined
—
crossing
"clamp" | "push" | undefined
Pointer collision: clamp stops the thumb; push moves its neighbour. Keyboard always preserves order and minGap.
Minimum distance in value units, rounded up to a whole number of steps.
0
name
string | undefined
—
onBlur
FocusEventHandler<HTMLInputElement> | undefined
—
onValueChange
((value: RangeSliderValue) => void) | undefined
—
onValueCommitted
((value: RangeSliderValue) => void) | undefined
—
step
number | undefined
1
thumbLabels
readonly [string, string] | undefined
Each thumb has its own accessible name. Defaults to Lower/Upper + label.
—
value
readonly [number, number] | undefined
—
Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.
Related controls
Notes to self
Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.