PyModel/pythinker-code / .agents/skills/opentui
opentui
VerifiedBuild terminal UIs with OpenTUI. Covers core, components, audio, keymaps, React, Solid, plugins, testing, standalone executables, QR encoding, SSH, and Three.js WebGPU.
docs/components/scrollbar.mdx
View on GitHub---
title: ScrollBar
description: Standalone scrollbar with arrows and keyboard control
order: 8
---
# ScrollBar
A standalone scrollbar component with optional arrows, keyboard navigation, and a draggable thumb.
## Basic usage
### Renderable API
```typescript
import { ScrollBarRenderable, createCliRenderer } from "@opentui/core"
const renderer = await createCliRenderer()
const scrollbar = new ScrollBarRenderable(renderer, {
id: "scrollbar",
orientation: "vertical",
height: 10,
showArrows: true,
trackOptions: {
backgroundColor: "#222222",
foregroundColor: "#888888",
},
onChange: (position) => {
console.log("Scroll position:", position)
},
})
// Connect the scrollbar to your content
scrollbar.scrollSize = 200
scrollbar.viewportSize = 20
scrollbar.scrollPosition = 0
renderer.root.add(scrollbar)
scrollbar.focus()
```
## Keyboard controls
When focused, the scrollbar responds to:
- `Up`/`Down` or `k`/`j` for vertical bars
- `Left`/`Right` or `h`/`l` for horizontal bars
- `PageUp`/`PageDown` for larger jumps
- `Home`/`End` to jump to start/end
## Construct API
> Not available yet. Use `ScrollBarRenderable` for now.
## Properties
| Property | Type | Default | Description |
| ---------------- | ------------------------------ | ------- | -------------------------------------- |
| `orientation` | `"vertical"` or `"horizontal"` | - | Scrollbar direction |
| `showArrows` | `boolean` | `false` | Show arrow buttons |
| `arrowOptions` | `ArrowOptions` | - | Styling for arrow buttons |
| `trackOptions` | `Partial<SliderOptions>` | - | Styling for the track and thumb |
| `scrollSize` | `number` | `0` | Total scrollable size |
| `viewportSize` | `number` | `0` | Visible size of the viewport |
| `scrollPosition` | `number` | `0` | Current scroll position |
| `scrollStep` | `number` | - | Step size when `scrollBy(..., "step")` |
| `onChange` | `(position: number) => void` | - | Fired when scroll position changes |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the work | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixes | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation code | Stars: 319k | Updated | Claude CodeCodex | Verified | Install |
| skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |