AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
TypeScript ai-agentai-agent-toolsai-agentsai-agents-frameworkmcpmcp-servermcp-toolsmcpsn8n-alternativeno-code-automationworkflowworkflow-automationworkflows
import { Slider as SliderPrimitive } from 'radix-ui';
import * as React from 'react';
import { cn } from '@/lib/utils';
function Slider({
className,
defaultValue,
value,
min = 0,
max = 100,
orientation = 'horizontal',
...props
}: React.ComponentProps<typeof SliderPrimitive.Root>) {
const isVertical = orientation === 'vertical';
const _values = React.useMemo(
() =>
Array.isArray(value)
? value
: Array.isArray(defaultValue)
? defaultValue
: [min, max],
[value, defaultValue, min, max],
);
return (
<SliderPrimitive.Root
data-slot="slider"
defaultValue={defaultValue}
value={value}
min={min}
max={max}
orientation={orientation}
className={cn(
'relative flex w-full touch-none items-center select-none data-[disabled]:opacity-50',
isVertical && 'h-full min-h-44 w-auto flex-col',
className,
)}
{...props}
>
<SliderPrimitive.Track
data-slot="slider-track"
className={cn(
'relative grow overflow-hidden rounded-full bg-gray-3',
isVertical ? 'h-full w-1.5' : 'h-1.5 w-full',
)}
>
<SliderPrimitive.Range
data-slot="slider-range"
className={cn(
'absolute bg-accent-9',
isVertical ? 'w-full' : 'h-full',
)}
/>
</SliderPrimitive.Track>
{Array.from({ length: _values.length }, (_, index) => (
<SliderPrimitive.Thumb
data-slot="slider-thumb"
key={index}
className="block size-4 shrink-0 rounded-full border border-accent-9 bg-panel shadow-sm ring-gray-8/50 transition-[color,box-shadow] hover:ring-4 focus-visible:ring-4 focus-visible:outline-hidden disabled:pointer-events-none disabled:opacity-50"
/>
))}
</SliderPrimitive.Root>
);
}
export { Slider };