Brutalist Slider
Select a single value or range along a track with pointer drag, keyboard stepping, and Field/Form integration.
Brutalist Slider renders single-value and multi-thumb range selection with 5px corners (rounded-base), 2px black borders, and crisp hard-shadow thumb feedback, supporting pointer drag, keyboard stepping, and Field / Form integration.
Preview
Section titled “Preview” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="mx-auto w-full max-w-xs">
<proto-ui-brutalist-slider-root id="demo-brutalist-slider-root">
<proto-ui-brutalist-slider-label>
Volume
</proto-ui-brutalist-slider-label>
<proto-ui-brutalist-slider-value></proto-ui-brutalist-slider-value>
<proto-ui-brutalist-slider-track>
<proto-ui-brutalist-slider-indicator></proto-ui-brutalist-slider-indicator>
<proto-ui-brutalist-slider-thumb></proto-ui-brutalist-slider-thumb>
</proto-ui-brutalist-slider-track>
</proto-ui-brutalist-slider-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#demo-brutalist-slider-root'
);
if (root instanceof HTMLElement) {
setElementProps(root, {
defaultValue: 75,
min: 0,
max: 100,
step: 1,
ariaLabel: 'Volume',
});
}
</script>Installation
Section titled “Installation”Available starting in 0.3.0-rc.1 and later releases. Import scalar slider parts and multi-value sliderValues* parts from @proto.ui/prototypes-brutalist/slider.
import { BrutalistSliderRoot, BrutalistSliderTrack, BrutalistSliderIndicator, BrutalistSliderThumb,} from '../proto-ui/components/react';
export function Example() { return ( <BrutalistSliderRoot defaultValue={33} min={0} max={100} step={1}> <BrutalistSliderTrack> <BrutalistSliderIndicator /> <BrutalistSliderThumb /> </BrutalistSliderTrack> </BrutalistSliderRoot> );}- Scalar parts:
Root,Label,Track,Indicator,Thumb,FieldThumb, andValue. UseFieldThumbinstead ofThumbinsideFieldorFormField. - Keyboard and controlled mode: Supports arrow keys,
Shift×10 stepping,PageUp/PageDown, andHome/End(mirrored in horizontal RTL). Passvaluefor controlled mode withvalueChangeandvalueCommitevents. - Range and multi-thumb: Compose
sliderValues*parts and configurethumbCollisionBehavioras'push','swap', or'none'.
Examples
Section titled “Examples”Two Thumbs
Section titled “Two Thumbs” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="mx-auto grid w-full max-w-xs gap-4">
<proto-ui-brutalist-slider-values-root
id="demo-brutalist-slider-values-root"
>
<proto-ui-brutalist-slider-values-label>
Price range
</proto-ui-brutalist-slider-values-label>
<proto-ui-brutalist-slider-values-value></proto-ui-brutalist-slider-values-value>
<proto-ui-brutalist-slider-values-track>
<proto-ui-brutalist-slider-values-indicator></proto-ui-brutalist-slider-values-indicator>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-values-t0"
></proto-ui-brutalist-slider-values-thumb>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-values-t1"
></proto-ui-brutalist-slider-values-thumb>
</proto-ui-brutalist-slider-values-track>
</proto-ui-brutalist-slider-values-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#demo-brutalist-slider-values-root'),
{
defaultValue: [25, 50],
min: 0,
max: 100,
step: 5,
minStepsBetweenValues: 1,
}
);
setElementProps(
document.querySelector('#demo-brutalist-slider-values-t0'),
{ index: 0, ariaLabel: 'Minimum price' }
);
setElementProps(
document.querySelector('#demo-brutalist-slider-values-t1'),
{ index: 1, ariaLabel: 'Maximum price' }
);
</script>Multiple Thumbs
Section titled “Multiple Thumbs” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="mx-auto w-full max-w-xs">
<proto-ui-brutalist-slider-values-root
id="demo-brutalist-slider-multiple-root"
>
<proto-ui-brutalist-slider-values-label>
Breakpoints
</proto-ui-brutalist-slider-values-label>
<proto-ui-brutalist-slider-values-value></proto-ui-brutalist-slider-values-value>
<proto-ui-brutalist-slider-values-track>
<proto-ui-brutalist-slider-values-indicator></proto-ui-brutalist-slider-values-indicator>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-multiple-t0"
></proto-ui-brutalist-slider-values-thumb>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-multiple-t1"
></proto-ui-brutalist-slider-values-thumb>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-multiple-t2"
></proto-ui-brutalist-slider-values-thumb>
</proto-ui-brutalist-slider-values-track>
</proto-ui-brutalist-slider-values-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#demo-brutalist-slider-multiple-root'),
{
defaultValue: [10, 20, 70],
min: 0,
max: 100,
step: 10,
}
);
[0, 1, 2].forEach((index) => {
setElementProps(
document.querySelector(
'#demo-brutalist-slider-multiple-t' + index
),
{ index }
);
});
</script>Vertical
Section titled “Vertical” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div
class="mx-auto flex h-40 max-w-xs items-center justify-center gap-8"
>
<proto-ui-brutalist-slider-root
id="demo-brutalist-slider-vertical-a"
>
<proto-ui-brutalist-slider-track>
<proto-ui-brutalist-slider-indicator></proto-ui-brutalist-slider-indicator>
<proto-ui-brutalist-slider-thumb></proto-ui-brutalist-slider-thumb>
</proto-ui-brutalist-slider-track>
</proto-ui-brutalist-slider-root>
<proto-ui-brutalist-slider-root
id="demo-brutalist-slider-vertical-b"
>
<proto-ui-brutalist-slider-track>
<proto-ui-brutalist-slider-indicator></proto-ui-brutalist-slider-indicator>
<proto-ui-brutalist-slider-thumb></proto-ui-brutalist-slider-thumb>
</proto-ui-brutalist-slider-track>
</proto-ui-brutalist-slider-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#demo-brutalist-slider-vertical-a'),
{ defaultValue: 50, orientation: 'vertical' }
);
setElementProps(
document.querySelector('#demo-brutalist-slider-vertical-b'),
{ defaultValue: 25, orientation: 'vertical' }
);
</script>Controlled
Section titled “Controlled” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="mx-auto grid w-full max-w-xs gap-3">
<div class="flex items-center justify-between text-sm">
<span>Temperature</span>
<span id="demo-brutalist-slider-controlled-readout">
0.3, 0.7
</span>
</div>
<proto-ui-brutalist-slider-values-root
id="demo-brutalist-slider-controlled-root"
>
<proto-ui-brutalist-slider-values-track>
<proto-ui-brutalist-slider-values-indicator></proto-ui-brutalist-slider-values-indicator>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-controlled-t0"
></proto-ui-brutalist-slider-values-thumb>
<proto-ui-brutalist-slider-values-thumb
id="demo-brutalist-slider-controlled-t1"
></proto-ui-brutalist-slider-values-thumb>
</proto-ui-brutalist-slider-values-track>
</proto-ui-brutalist-slider-values-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
const root = document.querySelector(
'#demo-brutalist-slider-controlled-root'
);
const readout = document.querySelector(
'#demo-brutalist-slider-controlled-readout'
);
setElementProps(root, {
value: [0.3, 0.7],
min: 0,
max: 1,
step: 0.1,
onValueChange: ({ value }) => {
setElementProps(root, { value });
if (readout)
readout.textContent = Array.isArray(value)
? value.join(', ')
: String(value);
},
});
setElementProps(
document.querySelector('#demo-brutalist-slider-controlled-t0'),
{ index: 0 }
);
setElementProps(
document.querySelector('#demo-brutalist-slider-controlled-t1'),
{ index: 1 }
);
</script>Disabled
Section titled “Disabled” Web Components React Vue Vue 2
Loading interactive preview… The article and source are ready to read. Interactive controls will appear here when ready.
<div class="mx-auto w-full max-w-xs">
<proto-ui-brutalist-slider-root
id="demo-brutalist-slider-disabled-root"
>
<proto-ui-brutalist-slider-label>
Disabled
</proto-ui-brutalist-slider-label>
<proto-ui-brutalist-slider-track>
<proto-ui-brutalist-slider-indicator></proto-ui-brutalist-slider-indicator>
<proto-ui-brutalist-slider-thumb></proto-ui-brutalist-slider-thumb>
</proto-ui-brutalist-slider-track>
</proto-ui-brutalist-slider-root>
</div>
<script type="module">
import { setElementProps } from '@proto.ui/adapter-web-component';
setElementProps(
document.querySelector('#demo-brutalist-slider-disabled-root'),
{
defaultValue: 50,
min: 0,
max: 100,
step: 1,
disabled: true,
}
);
</script>Root (Scalar)
Section titled “Root (Scalar)”| Prop | Type | Default |
|---|---|---|
value | number undefined | uncontrolled |
defaultValue | number | 0 |
min | number | 0 |
max | number | 100 |
step | number | 1 |
disabled | boolean | false |
readOnly | boolean | false |
orientation | 'horizontal' 'vertical' | horizontal |
direction | 'ltr' 'rtl' | ltr |
ariaLabel | string | '' |
valueText | string | '' |
Values Root & Parts (Multi-Thumb)
Section titled “Values Root & Parts (Multi-Thumb)”| Prop | Type | Default |
|---|---|---|
value | number readonly number[] | uncontrolled |
defaultValue | number readonly number[] | 0 |
largeStep | number | 10 × step |
minStepsBetweenValues | number | 0 |
thumbCollisionBehavior | 'push' 'swap' 'none' | 'push' |
required | boolean | false |
index (Thumb) | number | 0 |
startIndex / endIndex (Indicator) | number | full span |