Liking cljdoc? Tell your friends :D

charm.components.viewport

Scrollable text area component.

Displays a window into pre-rendered (possibly styled) text content.

Usage: (def vp (viewport "Long text content..." :height 10))

;; In update function: (viewport-update vp msg)

;; In view function: (viewport-view vp)

Scrollable text area component.

Displays a window into pre-rendered (possibly styled) text content.

Usage:
  (def vp (viewport "Long text content..." :height 10))

  ;; In update function:
  (viewport-update vp msg)

  ;; In view function:
  (viewport-view vp)
raw docstring

scroll-downclj

(scroll-down vp)
(scroll-down vp n)

Scroll down by n lines (default 1).

Scroll down by n lines (default 1).
sourceraw docstring

scroll-half-page-downclj

(scroll-half-page-down vp)

Scroll down by half the viewport height.

Scroll down by half the viewport height.
sourceraw docstring

scroll-half-page-upclj

(scroll-half-page-up vp)

Scroll up by half the viewport height.

Scroll up by half the viewport height.
sourceraw docstring

scroll-page-downclj

(scroll-page-down vp)

Scroll down by one full page.

Scroll down by one full page.
sourceraw docstring

scroll-page-upclj

(scroll-page-up vp)

Scroll up by one full page.

Scroll up by one full page.
sourceraw docstring

scroll-to-bottomclj

(scroll-to-bottom vp)

Scroll to the bottom.

Scroll to the bottom.
sourceraw docstring

scroll-to-topclj

(scroll-to-top vp)

Scroll to the top.

Scroll to the top.
sourceraw docstring

scroll-upclj

(scroll-up vp)
(scroll-up vp n)

Scroll up by n lines (default 1).

Scroll up by n lines (default 1).
sourceraw docstring

viewportclj

(viewport content
          &
          {:keys [width height y-offset keys id]
           :or {width 0 height 0 y-offset 0 id (rand-int 1000000)}})

Create a viewport component.

Content is a string (may contain ANSI escape sequences).

Options: :width - Display width (0 = no constraint) :height - Visible height in lines (0 = show all) :y-offset - Initial scroll position (default 0) :keys - Custom key bindings :id - Unique ID

Create a viewport component.

Content is a string (may contain ANSI escape sequences).

Options:
  :width   - Display width (0 = no constraint)
  :height  - Visible height in lines (0 = show all)
  :y-offset - Initial scroll position (default 0)
  :keys    - Custom key bindings
  :id      - Unique ID
sourceraw docstring

viewport-at-bottom?clj

(viewport-at-bottom? vp)

Check if the viewport is scrolled to the bottom.

Check if the viewport is scrolled to the bottom.
sourceraw docstring

viewport-at-top?clj

(viewport-at-top? vp)

Check if the viewport is scrolled to the top.

Check if the viewport is scrolled to the top.
sourceraw docstring

viewport-contentclj

(viewport-content vp)

Get the raw content string.

Get the raw content string.
sourceraw docstring

viewport-initclj

(viewport-init vp)

Initialize the viewport, returns [viewport cmd].

Initialize the viewport, returns [viewport cmd].
sourceraw docstring

viewport-line-countclj

(viewport-line-count vp)

Get the total number of lines in the content.

Get the total number of lines in the content.
sourceraw docstring

viewport-scroll-percentclj

(viewport-scroll-percent vp)

Get the current scroll position as a percentage (0.0-1.0).

Get the current scroll position as a percentage (0.0-1.0).
sourceraw docstring

viewport-scroll-toclj

(viewport-scroll-to vp line)

Scroll to a specific line number.

Scroll to a specific line number.
sourceraw docstring

viewport-set-contentclj

(viewport-set-content vp content)

Set the content, resetting scroll position.

Set the content, resetting scroll position.
sourceraw docstring

viewport-set-dimensionsclj

(viewport-set-dimensions vp width height)

Set the viewport width and height.

Set the viewport width and height.
sourceraw docstring

viewport-updateclj

(viewport-update vp msg)

Update viewport state based on a message. Returns [new-viewport cmd] or [viewport nil] if message not handled.

Update viewport state based on a message.
Returns [new-viewport cmd] or [viewport nil] if message not handled.
sourceraw docstring

viewport-viewclj

(viewport-view vp)

Render the viewport to a string.

Shows only the visible lines based on y-offset and height. If width is set, lines are padded/truncated to fit.

Render the viewport to a string.

Shows only the visible lines based on y-offset and height.
If width is set, lines are padded/truncated to fit.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close