Module: RatatuiRuby::Symbols::Line
- Defined in:
- lib/ratatui_ruby/symbols.rb
Overview
Box-drawing characters for borders and lines.
Terminal UIs need consistent box-drawing characters for borders and dividers. Memorizing Unicode box-drawing characters is tedious and error-prone.
This module exposes both individual characters and predefined sets. Use the sets with widgets that accept a line_set parameter, or use individual characters for custom drawing.
Examples
– SPDX-SnippetBegin SPDX-FileCopyrightText: 2026 Kerrick Long SPDX-License-Identifier: MIT-0 ++
# Use a predefined set for drawing boxes
line_set = Symbols::Line::ROUNDED
# Draw a simple frame
top = "#{line_set[:top_left]}#{line_set[:horizontal] * 10}#{line_set[:top_right]}"
mid = "#{line_set[:vertical]}#{' ' * 10}#{line_set[:vertical]}"
bot = "#{line_set[:bottom_left]}#{line_set[:horizontal] * 10}#{line_set[:bottom_right]}"
# Use individual characters for custom drawing
corner = Symbols::Line::ROUNDED_TOP_LEFT # => "╭"
– SPDX-SnippetEnd ++
Constant Summary collapse
- VERTICAL =
Standard vertical line.
"│"- DOUBLE_VERTICAL =
Double vertical line.
"║"- THICK_VERTICAL =
Thick (heavy) vertical line.
"┃"- HORIZONTAL =
Standard horizontal line.
"─"- DOUBLE_HORIZONTAL =
Double horizontal line.
"═"- THICK_HORIZONTAL =
Thick (heavy) horizontal line.
"━"- TOP_RIGHT =
Standard top-right corner.
"┐"- ROUNDED_TOP_RIGHT =
Rounded top-right corner.
"╮"- DOUBLE_TOP_RIGHT =
Double top-right corner.
"╗"- THICK_TOP_RIGHT =
Thick top-right corner.
"┓"- TOP_LEFT =
Standard top-left corner.
"┌"- ROUNDED_TOP_LEFT =
Rounded top-left corner.
"╭"- DOUBLE_TOP_LEFT =
Double top-left corner.
"╔"- THICK_TOP_LEFT =
Thick top-left corner.
"┏"- BOTTOM_RIGHT =
Standard bottom-right corner.
"┘"- ROUNDED_BOTTOM_RIGHT =
Rounded bottom-right corner.
"╯"- DOUBLE_BOTTOM_RIGHT =
Double bottom-right corner.
"╝"- THICK_BOTTOM_RIGHT =
Thick bottom-right corner.
"┛"- BOTTOM_LEFT =
Standard bottom-left corner.
"└"- ROUNDED_BOTTOM_LEFT =
Rounded bottom-left corner.
"╰"- DOUBLE_BOTTOM_LEFT =
Double bottom-left corner.
"╚"- THICK_BOTTOM_LEFT =
Thick bottom-left corner.
"┗"- VERTICAL_LEFT =
Standard T-junction pointing left.
"┤"- DOUBLE_VERTICAL_LEFT =
Double T-junction pointing left.
"╣"- THICK_VERTICAL_LEFT =
Thick T-junction pointing left.
"┫"- VERTICAL_RIGHT =
Standard T-junction pointing right.
"├"- DOUBLE_VERTICAL_RIGHT =
Double T-junction pointing right.
"╠"- THICK_VERTICAL_RIGHT =
Thick T-junction pointing right.
"┣"- HORIZONTAL_DOWN =
Standard T-junction pointing down.
"┬"- DOUBLE_HORIZONTAL_DOWN =
Double T-junction pointing down.
"╦"- THICK_HORIZONTAL_DOWN =
Thick T-junction pointing down.
"┳"- HORIZONTAL_UP =
Standard T-junction pointing up.
"┴"- DOUBLE_HORIZONTAL_UP =
Double T-junction pointing up.
"╩"- THICK_HORIZONTAL_UP =
Thick T-junction pointing up.
"┻"- CROSS =
Standard cross (4-way intersection).
"┼"- DOUBLE_CROSS =
Double cross (4-way intersection).
"╬"- THICK_CROSS =
Thick cross (4-way intersection).
"╋"- NORMAL =
Standard box-drawing set with straight corners.
{ vertical: VERTICAL, horizontal: HORIZONTAL, top_right: TOP_RIGHT, top_left: TOP_LEFT, bottom_right: BOTTOM_RIGHT, bottom_left: BOTTOM_LEFT, vertical_left: VERTICAL_LEFT, vertical_right: VERTICAL_RIGHT, horizontal_down: HORIZONTAL_DOWN, horizontal_up: HORIZONTAL_UP, cross: CROSS, }.freeze
- ROUNDED =
Box-drawing set with rounded corners.
{ vertical: VERTICAL, horizontal: HORIZONTAL, top_right: ROUNDED_TOP_RIGHT, top_left: ROUNDED_TOP_LEFT, bottom_right: ROUNDED_BOTTOM_RIGHT, bottom_left: ROUNDED_BOTTOM_LEFT, vertical_left: VERTICAL_LEFT, vertical_right: VERTICAL_RIGHT, horizontal_down: HORIZONTAL_DOWN, horizontal_up: HORIZONTAL_UP, cross: CROSS, }.freeze
- DOUBLE =
Double-line box-drawing set.
{ vertical: DOUBLE_VERTICAL, horizontal: DOUBLE_HORIZONTAL, top_right: DOUBLE_TOP_RIGHT, top_left: DOUBLE_TOP_LEFT, bottom_right: DOUBLE_BOTTOM_RIGHT, bottom_left: DOUBLE_BOTTOM_LEFT, vertical_left: DOUBLE_VERTICAL_LEFT, vertical_right: DOUBLE_VERTICAL_RIGHT, horizontal_down: DOUBLE_HORIZONTAL_DOWN, horizontal_up: DOUBLE_HORIZONTAL_UP, cross: DOUBLE_CROSS, }.freeze
- THICK =
Thick (heavy) box-drawing set.
{ vertical: THICK_VERTICAL, horizontal: THICK_HORIZONTAL, top_right: THICK_TOP_RIGHT, top_left: THICK_TOP_LEFT, bottom_right: THICK_BOTTOM_RIGHT, bottom_left: THICK_BOTTOM_LEFT, vertical_left: THICK_VERTICAL_LEFT, vertical_right: THICK_VERTICAL_RIGHT, horizontal_down: THICK_HORIZONTAL_DOWN, horizontal_up: THICK_HORIZONTAL_UP, cross: THICK_CROSS, }.freeze