package mosaic
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=9e4e90d17f9b2af1b07071fe425bc2c519c849c4f1d1ab73cde512be2d874849
sha512=06e9c4a741590942e81a27738d0b5c0413fafec8cf3b7dae047ad69f155e7b718aa4223818dc161b7d028efffcfd3365905e264d6fd31d453910ddfa91dcf9b9
doc/mosaic.ui/Mosaic_ui/Box/index.html
Module Mosaic_ui.Box
Bordered container with background fill and optional title.
Bordered container with background fill and optional title.
A box wraps a Renderable.t with border drawing, background filling, and child clipping. Each active border side consumes one terminal cell in layout; children are clipped to the content area inside borders.
Setting a border-related property (set_border_style, set_border_color, set_focused_border_color) auto-enables borders.
Construction
val create :
parent:Renderable.t ->
?index:int ->
?id:string ->
?style:Toffee.Style.t ->
?visible:bool ->
?z_index:int ->
?opacity:float ->
?border:bool ->
?border_style:Grid.Border.t ->
?border_sides:Grid.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 ] ->
unit ->
tcreate ~parent () is a box node attached to parent with:
borderdefaults tofalse. Providing any ofborder_style,border_color, orfocused_border_colorimplicitly enables it.border_styledefaults toGrid.Border.single.border_sidesdefaults toGrid.Border.all(all four sides).border_colordefaults toAnsi.Color.t.White.focused_border_colordefaults toAnsi.Color.t.Bright_cyan.backgrounddefaults toNone(transparent).filldefaults totrue.titledefaults toNone.title_alignmentdefaults to`Left.
val node : t -> Renderable.tnode t is t's underlying renderable.
Props
module Props : sig ... endapply_props t props replaces all properties of t with props, updates the border layout, and schedules a re-render.
Border
val set_border : t -> bool -> unitset_border t v enables or disables border rendering. Adjusts layout to reserve or release space for active border sides.
val set_border_style : t -> Grid.Border.t -> unitset_border_style t chars sets the border character set to chars. Auto-enables borders.
val set_border_sides : t -> Grid.Border.side list -> unitset_border_sides t sides selects which sides to draw. Adjusts layout for changed insets.
val set_border_color : t -> Ansi.Color.t -> unitset_border_color t color sets the unfocused border color. Auto-enables borders.
val set_focused_border_color : t -> Ansi.Color.t option -> unitset_focused_border_color t color sets the border color used when t has focus. None falls back to the unfocused color. Some _ auto-enables borders. Only triggers a re-render when t is focused.
Background
val set_background : t -> Ansi.Color.t option -> unitset_background t color sets the background fill color. None is transparent.
val set_fill : t -> bool -> unitset_fill t v enables or disables background filling of the interior. When false, the background color is ignored.
Title
val set_title : t -> string option -> unitset_title t text sets or clears the title drawn on the top border.
val set_title_alignment : t -> [ `Left | `Center | `Right ] -> unitset_title_alignment t align positions the title within the top border.
Layout
val set_style : t -> Toffee.Style.t -> unitset_style t style updates the layout style. Border insets are applied automatically on top of style.
Formatting
val pp : Format.formatter -> t -> unitpp formats a box for debugging.