Home / File/ slider.tsx — ui Source File

slider.tsx — ui Source File

Architecture documentation for slider.tsx, a tsx file in the ui codebase. 3 imports, 0 dependents.

File tsx DocumentationAtlas Changelog 3 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  e1d67c66_4940_aa4a_941c_1d54b297d3a2["slider.tsx"]
  1d141819_425e_b5fd_4c8e_32f7c6a42cf2["react"]
  e1d67c66_4940_aa4a_941c_1d54b297d3a2 --> 1d141819_425e_b5fd_4c8e_32f7c6a42cf2
  3d9438e8_7604_787c_4898_907262aff28b["utils"]
  e1d67c66_4940_aa4a_941c_1d54b297d3a2 --> 3d9438e8_7604_787c_4898_907262aff28b
  277373dc_9b0d_e2c9_5870_b530c755bcb2["slider"]
  e1d67c66_4940_aa4a_941c_1d54b297d3a2 --> 277373dc_9b0d_e2c9_5870_b530c755bcb2
  style e1d67c66_4940_aa4a_941c_1d54b297d3a2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

"use client"

import * as React from "react"
import { cn } from "@/examples/base/lib/utils"
import { Slider as SliderPrimitive } from "@base-ui/react/slider"

function Slider({
  className,
  defaultValue,
  value,
  min = 0,
  max = 100,
  ...props
}: SliderPrimitive.Root.Props) {
  const _values = React.useMemo(
    () =>
      Array.isArray(value)
        ? value
        : Array.isArray(defaultValue)
          ? defaultValue
          : [min, max],
    [value, defaultValue, min, max]
  )

  return (
    <SliderPrimitive.Root
      className={cn("data-horizontal:w-full data-vertical:h-full", className)}
      data-slot="slider"
      defaultValue={defaultValue}
      value={value}
      min={min}
      max={max}
      thumbAlignment="edge"
      {...props}
    >
      <SliderPrimitive.Control className="relative flex w-full touch-none items-center select-none data-disabled:opacity-50 data-vertical:h-full data-vertical:min-h-40 data-vertical:w-auto data-vertical:flex-col">
        <SliderPrimitive.Track
          data-slot="slider-track"
          className="bg-muted relative grow overflow-hidden rounded-full select-none data-horizontal:h-1 data-horizontal:w-full data-vertical:h-full data-vertical:w-1"
        >
          <SliderPrimitive.Indicator
            data-slot="slider-range"
            className="bg-primary select-none data-horizontal:h-full data-vertical:w-full"
          />
        </SliderPrimitive.Track>
        {Array.from({ length: _values.length }, (_, index) => (
          <SliderPrimitive.Thumb
            data-slot="slider-thumb"
            key={index}
            className="border-ring ring-ring/50 relative block size-3 shrink-0 rounded-full border bg-white transition-[color,box-shadow] select-none after:absolute after:-inset-2 hover:ring-3 focus-visible:ring-3 focus-visible:outline-hidden active:ring-3 disabled:pointer-events-none disabled:opacity-50"
          />
        ))}
      </SliderPrimitive.Control>
    </SliderPrimitive.Root>
  )
}

export { Slider }

Subdomains

Functions

Dependencies

  • react
  • slider
  • utils

Frequently Asked Questions

What does slider.tsx do?
slider.tsx is a source file in the ui codebase, written in tsx. It belongs to the DocumentationAtlas domain, Changelog subdomain.
What functions are defined in slider.tsx?
slider.tsx defines 1 function(s): Slider.
What does slider.tsx depend on?
slider.tsx imports 3 module(s): react, slider, utils.
Where is slider.tsx in the architecture?
slider.tsx is located at apps/v4/examples/base/ui/slider.tsx (domain: DocumentationAtlas, subdomain: Changelog, directory: apps/v4/examples/base/ui).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free