Scroll Thumb Size

Compute proportional scrollbar thumb size with an explicit minimum and track cap; no CSS or platform scrollbar rendering.

Description

Compute proportional scrollbar thumb size with an explicit minimum and track cap; no CSS or platform scrollbar rendering.

A proportional scrollbar thumb can be bounded by a minimum size and the total track length.

When to use this tool

Compute proportional scrollbar thumb size with an explicit minimum and track cap; no CSS or platform scrollbar rendering.

  • Prepare the supplied contentExtent, viewportExtent, trackExtent, minimumThumb fields for this operation.
  • Compare the complete example with the representation used by your own input before carrying the result into another step.

How to use the tool and how it works

  1. Enter contentExtent, viewportExtent, trackExtent, minimumThumb. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.thumbExtent. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require positive content/track extents, nonnegative viewport extent and minimumThumb within the track. Compute track*viewport/content, raise to the minimum and clamp to track.1

Input fieldMeaning and representationAccepted input
contentExtentcontent extent.Finite number; greater than zero
viewportExtentviewport extent.Finite number; zero or greater
trackExtenttrack extent.Finite number; greater than zero
minimumThumbminimum thumb.Finite number
Output fieldInterpretation
resultObject containing the named outputs below.
result.thumbExtentThe thumb extent value under the stated formula or text convention.
json
{
  "input": {
    "contentExtent": 200,
    "viewportExtent": 100,
    "trackExtent": 80,
    "minimumThumb": 10
  },
  "output": {
    "result": {
      "thumbExtent": 40
    }
  }
}

Limitations and assumptions

  • The viewport may exceed content, producing a full track thumb. No native scrollbar style, input handling or DOM measurement is included.
  • Rectangle arrays use [x,y,width,height] with nonnegative extents. All dimensions must use the same coordinate frame and unit; values are supplied rather than measured from a page.
  • Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
  • String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. Nonfinite results and excessively large serialized outputs are rejected.
  • Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.

Alternative or Complementary methods

Measure the actual layout when browser behavior matters. The formulas use supplied coordinates and explicit simplifications; they do not account for every box, writing mode, clipping ancestor or simultaneous layout change.

References

  1. Tool behavior and example: Scroll Thumb Size — tool.io

Similar or alternative tools

  • Scroll Thumb Position

    Map scroll position to thumb travel with explicit sizes and scroll range; non-scrollable content maps to zero.

  • Rectangle Scroll Reveal Delta

    Plan minimum-edge scroll reveal deltas in axis-aligned coordinates, prioritizing the leading edge when an item exceeds viewport size; no DOM scrolling occurs.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies