Module: RatatuiRuby::Symbols::Block

Defined in:
lib/ratatui_ruby/symbols.rb

Overview

Horizontal block characters for gauges and progress indicators.

Progress bars and gauges need characters that show partial fill from left to right. Memorizing Unicode left block characters is tedious and error-prone.

This module exposes both individual characters and predefined sets. Use the sets with Gauge widget, or use individual characters for custom progress indicators.

Note: Block uses LEFT block characters (fill from left) while Bar uses LOWER block characters (fill from bottom). They look similar but are different.

Examples

– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++

# Use NINE_LEVELS for high-resolution gauges (default)
gauge = tui.gauge(percent: 50, block_set: Symbols::Block::NINE_LEVELS)

# Use THREE_LEVELS for simpler rendering
gauge = tui.gauge(percent: 50, block_set: Symbols::Block::THREE_LEVELS)

– SPDX-SnippetEnd ++

Constant Summary collapse

FULL =

Full width block (8/8).

""
SEVEN_EIGHTHS =

7/8 width block.

""
THREE_QUARTERS =

3/4 width block (6/8).

""
FIVE_EIGHTHS =

5/8 width block.

""
HALF =

Half width block (4/8).

""
THREE_EIGHTHS =

3/8 width block.

""
ONE_QUARTER =

1/4 width block (2/8).

""
ONE_EIGHTH =

1/8 width block.

""
NINE_LEVELS =

High-resolution block set with 9 distinct levels.

{
  full: FULL,
  seven_eighths: SEVEN_EIGHTHS,
  three_quarters: THREE_QUARTERS,
  five_eighths: FIVE_EIGHTHS,
  half: HALF,
  three_eighths: THREE_EIGHTHS,
  one_quarter: ONE_QUARTER,
  one_eighth: ONE_EIGHTH,
  empty: " ",
}.freeze
THREE_LEVELS =

Low-resolution block set with 3 levels (full, half, empty).

{
  full: FULL,
  seven_eighths: FULL, # collapsed to full
  three_quarters: HALF, # collapsed to half
  five_eighths: HALF, # collapsed to half
  half: HALF,
  three_eighths: HALF, # collapsed to half
  one_quarter: HALF, # collapsed to half
  one_eighth: " ", # collapsed to empty
  empty: " ",
}.freeze