package mosaic

  1. Overview
  2. Docs
Terminal UI framework for OCaml with The Elm Architecture

Install

dune-project
 Dependency

Authors

Maintainers

Sources

mosaic-0.1.0.tbz
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9

doc/mosaic.mlx/Mosaic_mlx/index.html

Module Mosaic_mlxSource

MLX-compatible wrappers for Mosaic.

This module re-exports the full Mosaic API with child arguments changed from positional to optional, matching the MLX JSX convention where children are passed as ~children.

All types, modules, helpers, and non-overridden elements are inherited unchanged from Mosaic; see that module for their documentation. Only the elements listed below are overridden.

include module type of Mosaic

Re-exports

module Ansi = Matrix.Ansi

Terminal ANSI escape sequences: colors (Ansi.Color), styles (Ansi.Style), and attributes (Ansi.Attr).

module Border = Matrix.Grid.Border

Border character sets for box-drawing. Provides Border.single, Border.rounded, Border.heavy, Border.double, and Border.ascii.

Sourcemodule Event = Mosaic_ui.Event

Input event types for keyboard, mouse, and paste events.

Sourcemodule Canvas : sig ... end

Mutable cell-level drawing surface.

Geometry types

Sourcetype 'a size = 'a Toffee.Geometry.Size.t = {
  1. width : 'a;
  2. height : 'a;
}

The type for 2-dimensional sizes. See size and size_wh.

Sourcetype 'a rect = 'a Toffee.Geometry.Rect.t = {
  1. left : 'a;
  2. right : 'a;
  3. top : 'a;
  4. bottom : 'a;
}

The type for axis-aligned rectangles with four edges. See padding, margin, and inset.

Sourcetype 'a point = 'a Toffee.Geometry.Point.t = {
  1. x : 'a;
  2. y : 'a;
}

The type for 2-dimensional points.

Sourcetype 'a line = 'a Toffee.Geometry.Line.t = {
  1. start : 'a;
  2. end_ : 'a;
}

The type for line segments with start and end values. Used by Grid.line_range and Grid.span_range for grid placement.

Sourcetype dimension = Toffee.Style.Dimension.t

The type for CSS dimensions: a fixed length, a percentage, or auto. Create values with px, pct, or auto.

Sourcetype length_percentage = Toffee.Style.Length_percentage.t

The type for CSS length-or-percentage values. Produced by helpers such as padding, gap, and gap_xy.

Sourcetype length_percentage_auto = Toffee.Style.Length_percentage_auto.t

The type for CSS length-or-percentage-or-auto values. Produced by helpers such as margin, margin_xy, and inset.

Sourcetype span = Mosaic_ui.Text_buffer.span = {
  1. text : string;
  2. style : Ansi.Style.t;
}

A contiguous run of text with a single visual style. Used by code for syntax highlighting via its ~spans argument.

Layout enum modules

Sourcemodule Display : sig ... end

CSS display property controlling box generation and child layout algorithm.

Sourcemodule Position : sig ... end

CSS position property controlling normal flow participation.

Sourcemodule Box_sizing : sig ... end

CSS box-sizing property.

Sourcemodule Overflow : sig ... end

CSS overflow property.

Sourcemodule Text_align : sig ... end

CSS text-align property for block layout.

Sourcemodule Flex_direction : sig ... end

CSS flex-direction property.

Sourcemodule Flex_wrap : sig ... end

CSS flex-wrap property.

Sourcemodule Align : sig ... end

Alignment along the cross/block axis (align-items, align-self, justify-items, justify-self).

Sourcemodule Justify : sig ... end

Distribution of space between and around content items (align-content, justify-content).

Sourcemodule Grid_auto_flow : sig ... end

CSS grid-auto-flow property.

Grid module

Sourcemodule Grid : sig ... end

Grid layout constructors for defining tracks and placing items.

Widget types

Sourcemodule Select : sig ... end

Companion types for the select widget.

Sourcemodule Tab_select : sig ... end

Companion types for the tab_select widget.

Sourcemodule Table : sig ... end

Companion types for the table widget.

Sourcemodule Tree : sig ... end

Companion types for the tree widget.

Sourcemodule Spinner : sig ... end

Companion types for the spinner widget.

Sourcemodule Slider : sig ... end

Companion types for the slider widget.

Sourcemodule Scroll_bar : sig ... end

Companion types for the scroll_bar widget.

Sourcemodule Text_surface : sig ... end

Companion types for the text and code widgets.

Sourcemodule Line_number : sig ... end

Companion types for the line_number widget.

Sourcemodule Markdown : sig ... end

Companion types for the markdown widget.

Sourcemodule Syntax_theme : sig ... end

Syntax themes: maps capture-group names to terminal styles.

Views

Sourcetype 'msg t = 'msg option Mosaic_ui.Vnode.t

The type for view nodes parameterized by message type 'msg. Event handlers embedded in a node return 'msg option: Some msg dispatches the message into the update loop; None ignores the event.

Build values of this type with the element constructors (box, text, input, etc.) and compose them with fragment.

Sourceval map : ('a -> 'b) -> 'a t -> 'b t

map f view is view with every message transformed by f.

Use map to embed a child component whose message type differs from the parent's.

Commands

Sourcemodule Cmd : sig ... end

Side-effects issued by the application.

Subscriptions

Sourcemodule Sub : sig ... end

Ongoing event interests declared by the application.

Application

Sourcetype ('model, 'msg) app = {
  1. init : unit -> 'model * 'msg Cmd.t;
    (*

    init () is the initial model and any startup commands. Called once before the first render.

    *)
  2. update : 'msg -> 'model -> 'model * 'msg Cmd.t;
    (*

    update msg model is the new model and any side-effects produced in response to msg. Called once per dispatched message.

    *)
  3. view : 'model -> 'msg t;
    (*

    view model is the UI description for model. Called on every render cycle when the model has changed.

    *)
  4. subscriptions : 'model -> 'msg Sub.t;
    (*

    subscriptions model is the set of events the application wants to receive given model. Re-evaluated after every update.

    *)
}

The type for a Mosaic application. Provide a value of this type to run.

Running

Sourceval run : ?matrix:Matrix.app -> ?process_perform:((unit -> unit) -> unit) -> ('model, 'msg) app -> unit

run ?matrix ?process_perform app starts app and blocks until the application exits (via Cmd.quit or an OS signal).

  • matrix -- the low-level terminal backend. Defaults to a backend with target_fps = Some 60. and a hidden cursor.
  • process_perform -- controls how Cmd.t.Perform callbacks are executed. Receives a thunk that wraps the user callback with the dispatch function already wired in. The default spawns a native Thread per callback so that long-running operations (e.g. HTTP requests) never block the UI loop.

Eio integration. Pass a matrix and process_perform built with the matrix_eio library:

  Eio_main.run @@ fun env ->
  Eio.Switch.run @@ fun sw ->
  let matrix =
    Matrix_eio.create ~sw ~clock:(Eio.Stdenv.clock env) ~stdin:env#stdin
      ~stdout:env#stdout ()
  in
  let process_perform thunk =
    Eio.Fiber.fork_daemon ~sw (fun () ->
        thunk ();
        `Stop_daemon)
  in
  Mosaic.run ~matrix ~process_perform { init; update; view; subscriptions }

Daemon fibers are cancelled when the switch completes, so long-running perform operations do not block application shutdown.

Dimension helpers

Sourceval px : int -> dimension

px n is a dimension of exactly n terminal columns or rows.

Sourceval pct : int -> dimension

pct n is a dimension of n percent of the parent's available space.

Sourceval auto : dimension

auto is the automatic dimension, letting the layout engine determine the size.

Sourceval size : width:int -> height:int -> dimension size

size ~width ~height is a fixed size with the given width and height measured in terminal cells.

size_wh w h is a size with the given w width and h height dimensions.

Sourceval gap : int -> length_percentage size

gap n is a uniform gap of n cells applied to both axes of a flex or grid container.

Sourceval gap_xy : int -> int -> length_percentage size

gap_xy x y is a gap of x cells on the horizontal axis and y cells on the vertical axis.

Sourceval padding : int -> length_percentage rect

padding n is a uniform padding of n cells on all four sides.

Sourceval padding_xy : int -> int -> length_percentage rect

padding_xy x y is padding of x cells on the left and right sides and y cells on the top and bottom sides.

Sourceval padding_lrtb : int -> int -> int -> int -> length_percentage rect

padding_lrtb l r t b is padding of l cells on the left, r on the right, t on the top, and b on the bottom.

margin n is a uniform margin of n cells on all four sides.

Sourceval margin_xy : int -> int -> length_percentage_auto rect

margin_xy x y is margin of x cells on the left and right sides and y cells on the top and bottom sides.

Sourceval margin_lrtb : int -> int -> int -> int -> length_percentage_auto rect

margin_lrtb l r t b is margin of l cells on the left, r on the right, t on the top, and b on the bottom.

inset n is a uniform inset of n cells on all four sides, used with position = `Absolute or position = `Fixed.

Sourceval inset_lrtb : int -> int -> int -> int -> length_percentage_auto rect

inset_lrtb l r t b is inset of l cells on the left, r on the right, t on the top, and b on the bottom.

UI elements

Every element constructor accepts a large set of optional layout and styling arguments that mirror CSS flexbox and grid properties. Arguments shared across all elements are listed once here; only element-specific arguments are documented on each constructor.

Common layout arguments

  • key -- reconciler identity hint for list items.
  • id -- unique identifier used by Cmd.focus.
  • display -- layout mode (Display.t.Flex, Display.t.Grid, Display.t.Block, ...).
  • box_sizing -- whether size includes padding and border.
  • position -- positioning scheme (Position.t.Relative, Position.t.Absolute).
  • overflow -- how overflowing content is handled per axis.
  • scrollbar_width -- width reserved for overflow scrollbars.
  • text_align -- text alignment within the element.
  • inset -- position offsets for absolutely-positioned elements.
  • flex_direction, flex_wrap, justify_content, align_items, align_content, align_self, flex_grow, flex_shrink, flex_basis -- flexbox properties.
  • justify_items, justify_self -- grid alignment properties.
  • size, min_size, max_size -- element dimensions.
  • aspect_ratio -- width-to-height ratio constraint.
  • gap -- spacing between flex or grid children.
  • padding -- inner spacing between border and content.
  • margin -- outer spacing outside the border.
  • border_width -- widths of each border side in cells.
  • grid_template_rows, grid_template_columns, grid_auto_rows, grid_auto_columns, grid_auto_flow, grid_template_areas, grid_template_column_names, grid_template_row_names, grid_row, grid_column -- CSS grid properties.
  • visible -- when false the element takes no space and is not rendered. Defaults to true.
  • z_index -- stacking order for overlapping elements.
  • opacity -- alpha in [0.;1.]; 1. is fully opaque.
  • focusable -- when true the element can receive keyboard focus. Defaults to false.
  • autofocus -- when true the element receives focus on mount. Defaults to false.
  • buffered -- when true renders to an off-screen buffer. Defaults to false.
  • live -- when true the element re-renders every frame even when the model has not changed. Defaults to false.
  • ref -- callback invoked with the rendered Mosaic_ui.Renderable.t after each frame.
  • on_mouse -- mouse event handler for this element.
  • on_key -- key event handler for this element.
  • on_paste -- paste event handler for this element.
Sourceval empty : 'msg t

empty is the empty view that renders nothing and occupies no space. Useful as a placeholder.

Sourceval embed : Mosaic_ui.Renderable.t -> 'msg t

embed r wraps a pre-rendered Mosaic_ui.Renderable.t as a view node. Use this to integrate non-TEA rendering into the view tree.

Sourceval slider : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?orientation:Slider.orientation -> ?value:float -> ?min:float -> ?max:float -> ?viewport_size:float -> ?track_color:Ansi.Color.t -> ?thumb_color:Ansi.Color.t -> ?on_value_change:(float -> 'msg option) -> unit -> 'msg t

slider () is an interactive range slider.

Slider-specific optional arguments:

  • orientation -- `Horizontal or `Vertical. Defaults to `Horizontal.
  • value -- current thumb position. Defaults to 0..
  • min -- minimum value of the range. Defaults to 0..
  • max -- maximum value of the range. Defaults to 1..
  • viewport_size -- size of the visible viewport relative to the total range; used to size the thumb proportionally.
  • track_color -- color of the slider track.
  • thumb_color -- color of the slider thumb.
  • on_value_change -- callback fired when the value changes; receives the new value and returns an optional message.
Sourceval select : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?selected_index:int -> ?background:Ansi.Color.t -> ?text_color:Ansi.Color.t -> ?focused_background:Ansi.Color.t -> ?focused_text_color:Ansi.Color.t -> ?selected_background:Ansi.Color.t -> ?selected_text_color:Ansi.Color.t -> ?description_color:Ansi.Color.t -> ?selected_description_color:Ansi.Color.t -> ?show_description:bool -> ?show_scroll_indicator:bool -> ?wrap_selection:bool -> ?item_spacing:int -> ?fast_scroll_step:int -> ?on_change:(int -> 'msg option) -> ?on_activate:(int -> 'msg option) -> Select.item list -> 'msg t

select items is a vertical list from which the user can choose one item.

See tab_select for a horizontal tab-bar variant.

Select-specific optional arguments:

  • selected_index -- zero-based index of the highlighted item. Defaults to 0.
  • background -- background color of unselected items.
  • text_color -- foreground color of unselected items.
  • focused_background -- background when the widget has focus.
  • focused_text_color -- foreground when the widget has focus.
  • selected_background -- background of the selected item.
  • selected_text_color -- foreground of the selected item.
  • description_color -- color of item description text.
  • selected_description_color -- description color for the selected item.
  • show_description -- when true shows item descriptions. Defaults to true.
  • show_scroll_indicator -- when true shows a scroll indicator when the list overflows. Defaults to false.
  • wrap_selection -- when true wraps the selection from the last item back to the first and vice versa. Defaults to false.
  • item_spacing -- number of blank lines between items. Defaults to 0.
  • fast_scroll_step -- number of items skipped per fast-scroll action (e.g. Page Down). Defaults to 5.
  • on_change -- fired when the highlighted index changes; receives the new index.
  • on_activate -- fired when the user confirms the selection (e.g. by pressing Enter); receives the confirmed index.
Sourceval tab_select : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?selected:int -> ?tab_width:int -> ?background:Ansi.Color.t -> ?text_color:Ansi.Color.t -> ?focused_background:Ansi.Color.t -> ?focused_text_color:Ansi.Color.t -> ?selected_background:Ansi.Color.t -> ?selected_text_color:Ansi.Color.t -> ?description_color:Ansi.Color.t -> ?selected_description_color:Ansi.Color.t -> ?show_underline:bool -> ?show_description:bool -> ?show_scroll_arrows:bool -> ?wrap_selection:bool -> ?on_change:(int -> 'msg option) -> ?on_activate:(int -> 'msg option) -> Tab_select.item list -> 'msg t

tab_select items is a horizontal tab-bar selector.

See select for the vertical list variant.

Tab-select-specific optional arguments:

  • selected -- zero-based index of the active tab. Defaults to 0.
  • tab_width -- fixed width for each tab in cells. Defaults to 12.
  • background -- background color of inactive tabs.
  • text_color -- foreground color of inactive tabs.
  • focused_background -- background when the widget has focus.
  • focused_text_color -- foreground when the widget has focus.
  • selected_background -- background of the active tab.
  • selected_text_color -- foreground of the active tab.
  • description_color -- color of tab description text.
  • selected_description_color -- description color for the active tab.
  • show_underline -- when true draws an underline below tabs. Defaults to true.
  • show_description -- when true shows tab descriptions. Defaults to false.
  • show_scroll_arrows -- when true shows arrows when tabs overflow the available width. Defaults to true.
  • wrap_selection -- when true wraps from the last tab to the first and vice versa. Defaults to false.
  • on_change -- fired when the active tab index changes.
  • on_activate -- fired when the user confirms the tab selection.
Sourceval canvas : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?respect_alpha:bool -> (Canvas.t -> delta:float -> unit) -> 'msg t

canvas draw is a free-form drawing surface. draw c ~delta is called on every frame with a fresh Canvas.t c and the elapsed time delta in seconds since the previous frame. The canvas fills its allocated layout area.

Canvas-specific optional arguments:

  • respect_alpha -- when true the canvas composites with alpha blending. Defaults to true.
Sourceval spinner : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?frame_set:Spinner.frame_set -> ?color:Ansi.Color.t -> unit -> 'msg t

spinner () is an animated activity indicator.

Spinner-specific optional arguments:

  • frame_set -- the animation frame sequence. Defaults to Spinner.dots.
  • color -- foreground color of the spinner character. Defaults to white.
Sourceval progress_bar : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?value:float -> ?min:float -> ?max:float -> ?orientation:[ `Horizontal | `Vertical ] -> ?filled_color:Ansi.Color.t -> ?empty_color:Ansi.Color.t -> unit -> 'msg t

progress_bar () is a read-only progress indicator.

Progress-bar-specific optional arguments:

  • value -- current progress value. Defaults to 0..
  • min -- value representing 0% progress. Defaults to 0..
  • max -- value representing 100% progress. Defaults to 1..
  • orientation -- `Horizontal or `Vertical. Defaults to `Horizontal.
  • filled_color -- color of the filled portion of the bar. Defaults to medium gray.
  • empty_color -- color of the unfilled portion of the bar. Defaults to dark gray.
Sourceval scroll_bar : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?orientation:Scroll_bar.orientation -> ?show_arrows:bool -> ?track_color:Ansi.Color.t -> ?thumb_color:Ansi.Color.t -> ?arrow_fg:Ansi.Color.t -> ?arrow_bg:Ansi.Color.t -> ?on_change:(int -> 'msg option) -> unit -> 'msg t

scroll_bar () is a standalone scroll-bar widget. Use this when you manage scroll state externally; for automatic scrolling consider scroll_box instead.

Scroll-bar-specific optional arguments:

  • orientation -- `Horizontal or `Vertical. Defaults to `Vertical.
  • show_arrows -- when true renders arrow buttons at each end. Defaults to false.
  • track_color -- color of the scroll track. Defaults to dark gray.
  • thumb_color -- color of the scroll thumb. Defaults to medium gray.
  • arrow_fg -- foreground color of the arrow buttons. Defaults to white.
  • arrow_bg -- background color of the arrow buttons. Defaults to the terminal default.
  • on_change -- fired when the scroll position changes; receives the new position in scroll units.
Sourceval table : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?columns:Table.column list -> ?rows:Table.cell array list -> ?selected_row:int -> ?border:bool -> ?border_style:Border.t -> ?show_header:bool -> ?show_column_separator:bool -> ?show_row_separator:bool -> ?cell_padding:int -> ?header_color:Ansi.Color.t -> ?header_background:Ansi.Color.t -> ?text_color:Ansi.Color.t -> ?background:Ansi.Color.t -> ?selected_text_color:Ansi.Color.t -> ?selected_background:Ansi.Color.t -> ?focused_selected_text_color:Ansi.Color.t -> ?focused_selected_background:Ansi.Color.t -> ?row_styles:Ansi.Style.t list -> ?wrap_selection:bool -> ?fast_scroll_step:int -> ?on_change:(int -> 'msg option) -> ?on_activate:(int -> 'msg option) -> unit -> 'msg t

table () is a scrollable data table.

Table-specific optional arguments:

  • columns -- column definitions (Table.column), including headers and sizing. Defaults to [].
  • rows -- table data as a list of cell arrays. Each array must have the same length as columns. Defaults to [].
  • selected_row -- zero-based index of the highlighted row. Defaults to 0.
  • border -- when true draws an outer border. Defaults to true.
  • border_style -- character set for the outer border. Defaults to Border.single.
  • show_header -- when true renders a header row. Defaults to true.
  • show_column_separator -- when true draws vertical lines between columns. Defaults to false.
  • show_row_separator -- when true draws horizontal lines between rows. Defaults to false.
  • cell_padding -- horizontal padding in cells within each cell. Defaults to 0.
  • header_color -- foreground color of the header row.
  • header_background -- background color of the header row.
  • text_color -- foreground color of body cells.
  • background -- background color of body cells.
  • selected_text_color -- foreground of the selected row.
  • selected_background -- background of the selected row.
  • focused_selected_text_color -- foreground of the selected row when the table has focus.
  • focused_selected_background -- background of the selected row when the table has focus.
  • row_styles -- repeating list of styles applied to body rows, useful for alternating row colors.
  • wrap_selection -- when true wraps selection past the last or first row. Defaults to false.
  • fast_scroll_step -- rows skipped per fast-scroll action. Defaults to 5.
  • on_change -- fired when the selected row index changes.
  • on_activate -- fired when the user confirms the selected row (e.g. by pressing Enter).
Sourceval tree : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?items:Tree.item list -> ?selected_index:int -> ?expand_depth:int -> ?indent_size:int -> ?show_guides:bool -> ?guide_style:Border.t -> ?expand_icon:string -> ?collapse_icon:string -> ?leaf_icon:string -> ?background:Ansi.Color.t -> ?text_color:Ansi.Color.t -> ?selected_background:Ansi.Color.t -> ?selected_text_color:Ansi.Color.t -> ?focused_selected_background:Ansi.Color.t -> ?focused_selected_text_color:Ansi.Color.t -> ?guide_color:Ansi.Color.t -> ?icon_color:Ansi.Color.t -> ?wrap_selection:bool -> ?fast_scroll_step:int -> ?on_change:(int -> 'msg option) -> ?on_activate:(int -> 'msg option) -> ?on_expand:(int -> bool -> 'msg option) -> unit -> 'msg t

tree () is an interactive collapsible tree view.

Tree-specific optional arguments:

  • items -- the root-level Tree.item nodes. Defaults to [].
  • selected_index -- zero-based flat index of the highlighted item. Defaults to 0.
  • expand_depth -- number of levels expanded on first render. 0 collapses all; use max_int to expand everything. Defaults to 0.
  • indent_size -- cells of indentation per nesting level. Defaults to 2.
  • show_guides -- when true draws vertical guide lines. Defaults to false.
  • guide_style -- border character set used for guide lines.
  • expand_icon -- string shown next to collapsible nodes when collapsed. Defaults to "▶".
  • collapse_icon -- string shown next to collapsible nodes when expanded. Defaults to "▼".
  • leaf_icon -- string shown next to leaf nodes. Defaults to " ".
  • background -- background color of unselected items.
  • text_color -- foreground color of unselected items.
  • selected_background -- background of the selected item.
  • selected_text_color -- foreground of the selected item.
  • focused_selected_background -- background of the selected item when the widget has focus.
  • focused_selected_text_color -- foreground of the selected item when the widget has focus.
  • guide_color -- color of the vertical guide lines.
  • icon_color -- color of the expand/collapse/leaf icons.
  • wrap_selection -- when true wraps selection past the last or first visible item. Defaults to false.
  • fast_scroll_step -- items skipped per fast-scroll action. Defaults to 5.
  • on_change -- fired when the selected index changes.
  • on_activate -- fired when the user confirms the selection.
  • on_expand -- fired when a node is expanded or collapsed; receives the flat index and true if expanded, false if collapsed.

Internal modules

Sourcemodule Reconciler = Mosaic.Reconciler

The virtual-DOM reconciler used by run.

Overridden elements

Each element below replaces its Mosaic counterpart solely to turn the positional children argument into ?children with a trailing unit. All other arguments, defaults, and semantics are identical to Mosaic; refer to the corresponding entry there for details.

For text-based elements (text, code, markdown) children is string list whose items are concatenated.

Sourceval fragment : ?children:'msg t list -> unit -> 'msg t

Like Mosaic.fragment. children defaults to [].

Sourceval box : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?border:bool -> ?border_style:Border.t -> ?border_sides:Border.side list -> ?border_color:Ansi.Color.t -> ?focused_border_color:Ansi.Color.t -> ?background:Ansi.Color.t -> ?fill:bool -> ?title:string -> ?title_alignment:[ `Left | `Center | `Right ] -> ?children:'msg t list -> unit -> 'msg t

Like Mosaic.box. children defaults to [].

Sourceval text : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?style:Ansi.Style.t -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?text_style:Ansi.Style.t -> ?wrap:Text_surface.wrap -> ?selectable:bool -> ?selection_bg:Ansi.Color.t -> ?selection_fg:Ansi.Color.t -> ?tab_width:int -> ?truncate:bool -> ?children:string list -> unit -> 'msg t

Like Mosaic.span.text. children is a string list whose items are concatenated. Defaults to [].

Sourceval scroll_box : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?scroll_x:bool -> ?scroll_y:bool -> ?sticky_scroll:bool -> ?sticky_start:[ `Top | `Bottom | `Left | `Right ] -> ?background:Ansi.Color.t -> ?on_scroll:(x:int -> y:int -> 'msg option) -> ?children:'msg t list -> unit -> 'msg t

Like Mosaic.scroll_box. children defaults to [].

Sourceval code : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?spans:span list -> ?text_style:Ansi.Style.t -> ?wrap:Text_surface.wrap -> ?tab_width:int -> ?selectable:bool -> ?selection_bg:Ansi.Color.t -> ?selection_fg:Ansi.Color.t -> ?on_selection:((int * int) option -> 'msg option) -> ?children:string list -> unit -> 'msg t

Like Mosaic.code. children is a string list whose items are concatenated. Defaults to [].

Sourceval markdown : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?md_style:Markdown.style -> ?conceal:bool -> ?streaming:bool -> ?children:string list -> unit -> 'msg t

Like Mosaic.markdown. children is a string list whose items are concatenated. Defaults to [].

Sourceval input : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?value:string -> ?cursor:int -> ?selection:(int * int) option -> ?placeholder:string -> ?max_length:int -> ?text_color:Ansi.Color.t -> ?background_color:Ansi.Color.t -> ?focused_text_color:Ansi.Color.t -> ?focused_background_color:Ansi.Color.t -> ?placeholder_color:Ansi.Color.t -> ?selection_color:Ansi.Color.t -> ?selection_fg:Ansi.Color.t -> ?cursor_style:[ `Block | `Line | `Underline ] -> ?cursor_color:Ansi.Color.t -> ?cursor_blinking:bool -> ?on_input:(string -> 'msg option) -> ?on_change:(string -> 'msg option) -> ?on_submit:(string -> 'msg option) -> ?on_cursor:(cursor:int -> selection:(int * int) option -> 'msg option) -> ?children:'msg t list -> unit -> 'msg t

Like Mosaic.input. children defaults to [].

Sourceval textarea : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?value:string -> ?cursor:int -> ?selection:(int * int) option -> ?spans:Mosaic.span list -> ?ghost_text:string -> ?ghost_text_color:Ansi.Color.t -> ?placeholder:string -> ?wrap:Text_surface.wrap -> ?text_color:Ansi.Color.t -> ?background_color:Ansi.Color.t -> ?focused_text_color:Ansi.Color.t -> ?focused_background_color:Ansi.Color.t -> ?placeholder_color:Ansi.Color.t -> ?selection_color:Ansi.Color.t -> ?selection_fg:Ansi.Color.t -> ?cursor_style:[ `Block | `Line | `Underline ] -> ?cursor_color:Ansi.Color.t -> ?cursor_blinking:bool -> ?on_input:(string -> 'msg option) -> ?on_change:(string -> 'msg option) -> ?on_submit:(string -> 'msg option) -> ?on_cursor:(cursor:int -> selection:(int * int) option -> 'msg option) -> ?children:'msg t list -> unit -> 'msg t

Like Mosaic.textarea. children defaults to [].

Sourceval line_number : ?key:string -> ?id:string -> ?display:Display.t -> ?box_sizing:Box_sizing.t -> ?position:Position.t -> ?overflow:Overflow.t point -> ?scrollbar_width:float -> ?text_align:Text_align.t -> ?inset:length_percentage_auto rect -> ?flex_direction:Flex_direction.t -> ?flex_wrap:Flex_wrap.t -> ?justify_content:Justify.t -> ?align_items:Align.t -> ?size:dimension size -> ?min_size:dimension size -> ?max_size:dimension size -> ?aspect_ratio:float -> ?gap:length_percentage size -> ?padding:length_percentage rect -> ?margin:length_percentage_auto rect -> ?border_width:length_percentage rect -> ?align_self:Align.t -> ?align_content:Justify.t -> ?justify_items:Align.t -> ?justify_self:Align.t -> ?flex_grow:float -> ?flex_shrink:float -> ?flex_basis:dimension -> ?grid_template_rows:Grid.template list -> ?grid_template_columns:Grid.template list -> ?grid_auto_rows:Grid.track list -> ?grid_auto_columns:Grid.track list -> ?grid_auto_flow:Grid_auto_flow.t -> ?grid_template_areas:Grid.area list -> ?grid_template_column_names:string list list -> ?grid_template_row_names:string list list -> ?grid_row:Grid.placement line -> ?grid_column:Grid.placement line -> ?visible:bool -> ?z_index:int -> ?opacity:float -> ?focusable:bool -> ?autofocus:bool -> ?buffered:bool -> ?live:bool -> ?ref:(Mosaic_ui.Renderable.t -> unit) -> ?on_mouse:(Event.mouse -> 'msg option) -> ?on_key:(Event.key -> 'msg option) -> ?on_paste:(Event.paste -> 'msg option) -> ?fg:Ansi.Color.t -> ?bg:Ansi.Color.t -> ?min_width:int -> ?padding_right:int -> ?show_line_numbers:bool -> ?line_number_offset:int -> ?line_colors:(int * Line_number.line_color) list -> ?line_signs:(int * Line_number.line_sign) list -> ?hidden_line_numbers:int list -> ?children:'msg t list -> unit -> 'msg t

Like Mosaic.line_number. children defaults to []; pass the wrapped element (e.g. a code) as a single-item list.