opentui

Build terminal UIs with OpenTUI. Covers Core, frameworks, components, application APIs, testing, extensions, integrations, deployment, and public API lookup.

Install
npx skills add 'https://github.com/anomalyco/opentui/tree/main/packages/web/src/content'
Download bundle ↓
main · ac753b4Scanned 2026-09-15

Contributors

GitHub-linked commit authors for this SKILL.md at the saved revision. Co-authors and history before file renames are not included.

File history ↗

docs/components/slider.mdx

docs/components/slider.mdxBrowse 89 files
View on GitHub
← Back to SKILL.md

title: Slider description: Choose a continuous value with a mouse-dragged slider

Slider

Slider selects a continuous value by dragging a horizontal or vertical thumb. Use Select for discrete choices.

Availability

FieldAvailability
Package@opentui/core
Core renderableSliderRenderable
ReactUnavailable
SolidUnavailable
StatusBuilt-in Core renderable

Basic usage

Renderable API

import { SliderRenderable, createCliRenderer } from "@opentui/core"

const renderer = await createCliRenderer()

const slider = new SliderRenderable(renderer, {
  id: "volume",
  orientation: "horizontal",
  width: 30,
  height: 1,
  min: 0,
  max: 100,
  value: 25,
  onChange: (value) => {
    console.log("Value:", value)
  },
})

renderer.root.add(slider)
value: 25
       ██▌
0                          100

Vertical slider

const slider = new SliderRenderable(renderer, {
  orientation: "vertical",
  width: 2,
  height: 10,
  min: 0,
  max: 1,
  value: 0.5,
})
min 0

           ▄▄
           ██
value 0.5  ██
           ██
           ██
           ▀▀

max 1

Properties

PropertyTypeDefaultDescription
orientation"vertical" | "horizontal"requiredSlider direction
valuenumberminCurrent value
minnumber0Minimum value
maxnumber100Maximum value
viewPortSizenumberMath.max(1, (max - min) * 0.1)Viewport size used to calculate the thumb size
backgroundColorColorInput"#252527"Track color
foregroundColorColorInput"#9a9ea3"Thumb color
onChange(value: number) => void-Called when the stored value changes

ScrollBar uses the same track-and-thumb model for a scroll position. Read Interaction, focus, and selection for pointer input and event behavior.