package stk

  1. Overview
  2. Docs
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

Module Stk.FlexSource

Flex container widget.

Properties

Sourceval inter_space : int Props.prop

Property to specify the size of space between two items.

Sourceval css_inter_space : int Css.P.prop
Sourceval wrap : bool Props.prop

Property "flex_wrap" to specify whether lines can be wrapped when they don't fit.

Sourceval css_wrap : bool Css.P.prop
Sourceval wrap_on_break : bool Props.prop

Property "flex_wrap_on_break" to specify whether a line is broken when a `Break item is encountered.

Sourceval css_wrap_on_break : bool Css.P.prop
Sourceval collapse_spaces : bool Props.prop

Property "flex_collapse_spaces" to specify whether `Space items must be collapsed.

Sourceval css_collapse_spaces : bool Css.P.prop
Sourceval expand : int Props.prop

Property "flex_item_expand" to specify how an item must expand. A value higher than the other items on the same line will give more space to this item.

Sourceval css_expand : int Css.P.prop
Sourcetype item_kind = [
  1. | `Block
  2. | `Break
  3. | `Item
  4. | `Space of bool
]

Item kind indicates how to handle an item:

  • `Break indicates a break of line, which can be considered as space or real break, depending on the wrap_on_break property,
  • `Block indicates that this item must be arranged alone on a line,
  • `Item indicates that this item is "normal" and can be arranged inline,
  • `Space b indicates that this item is a space in arrangement algorithm. b = true is used internally to indicate that this space must be taken into account when computing coordinates.
Sourceval item_kind : item_kind Props.prop

"flex_item_kind" property. Default value is `Item.

Justification

Sourcetype justification = [
  1. | `Center
  2. | `End
  3. | `Justified
  4. | `Space_around
  5. | `Space_between
  6. | `Start
]

Justification of items:

  • `Start aligns items on the left in horizontal flex, on top in vertical flex.
  • `End aligns items on the right in horizontal flex, on bottom in vertical flex.
  • `Center centers items #CaptainObvious.
  • `Space_around distributes spaces at the beginning of line, between items and at the end of line.
  • `Space_betwwen distributes spaces between items, leaving no space at the beginning and the end of the line.
  • `Justified is like `Space_between except that the last line is justified as `Start (like a regular text paragraph).
Sourceval justifications : [> `Center | `End | `Justified | `Space_around | `Space_between | `Start ] list
Sourceval string_of_justification : justification -> string
Sourceval justification_of_string : string -> justification option
Sourcemodule TJustification : sig ... end
Sourcemodule PJustification : sig ... end
Sourceval justification : justification Props.prop

"flex_justification" property. Default value is `Start.

Sourceval css_justification_prop : ?inherited:bool -> ?def:justification -> justification Props.prop -> justification Css.P.prop
Sourceval css_justification : justification Css.P.prop

Items alignement

Sourcetype items_alignment = [
  1. | `Baseline
  2. | `Center
  3. | `End
  4. | `Start
  5. | `Stretch
]
Sourceval items_alignments : [> `Baseline | `Center | `End | `Start | `Stretch ] list
Sourceval string_of_items_alignment : [< `Baseline | `Center | `End | `Start | `Stretch ] -> string
Sourceval items_alignment_of_string : string -> [ `Baseline | `Center | `End | `Start | `Stretch ] option
Sourcemodule TItems_alignment : sig ... end
Sourcemodule PItems_alignement : sig ... end
Sourceval items_alignment : items_alignment Props.prop

"flex_items_alignment" property. Default is `Baseline.

Sourceval css_items_alignment_prop : ?inherited:bool -> ?def:[ `Baseline | `Center | `End | `Start | `Stretch ] -> [ `Baseline | `Center | `End | `Start | `Stretch ] Props.prop -> [ `Baseline | `Center | `End | `Start | `Stretch ] Css.P.prop
Sourceval css_items_alignment : items_alignment Css.P.prop

Content alignement

Sourcetype content_alignment = [
  1. | `Center
  2. | `End
  3. | `Space_around
  4. | `Space_between
  5. | `Start
  6. | `Stretch
]
Sourceval content_alignments : [> `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] list
Sourceval string_of_content_alignment : [< `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] -> string
Sourceval content_alignment_of_string : string -> [ `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] option
Sourcemodule TContent_alignment : sig ... end
Sourcemodule PContent_alignment : sig ... end
Sourceval content_alignment : content_alignment Props.prop

"flex_content_alignment" property. Default is `Stretch.

Sourceval css_content_alignment_prop : ?inherited:bool -> ?def:[ `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] -> [ `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] Props.prop -> [ `Center | `End | `Space_around | `Space_between | `Start | `Stretch ] Css.P.prop
Sourceval css_content_alignment : content_alignment Css.P.prop
Sourceclass space : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> unit -> object ... end

A space item. Use space or break to create it, as it will set the correct value for item_kind property. Widget kind is "flex_space".

Sourceval space : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> unit -> space

Create a space item with correct item_kind value. See Widget arguments for arguments.

Sourceval break : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> unit -> space

Create a space item with `Break for item_kind property. Widget has same kind as space with additional class "break". See Widget arguments for arguments.

Sourceclass 'a flex : ?classes:string list option -> ?name:string option -> ?props:Props.t option -> ?wdata: Widget.wdata option -> unit -> object ... end

Container widget behaving like CSS flex box. The widget has class "vertical" or "horizontal" depending on orientation.

Sourceval flex : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?orientation:Props.orientation -> ?justification:justification -> ?items_alignment:items_alignment -> ?content_alignment:content_alignment -> ?inter_space:int -> ?wrap:bool -> ?wrap_on_break:bool -> ?collapse_spaces:bool -> ?pack:(Widget.widget -> unit) -> unit -> 'a flex

Convenient function to create a flex. Optional arguments:

  • orientation specifies horizontal or vertical packing. Default is Props.orientation.Horizontal.
  • justification, items_alignment, content_alignment, inter_space, wrap, wrap_on_break and collapse_spaces are used to set the corresponding properties.

See Widget arguments for other arguments.

Sourceval hflex : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?justification:justification -> ?items_alignment:items_alignment -> ?content_alignment:content_alignment -> ?inter_space:int -> ?wrap:bool -> ?wrap_on_break:bool -> ?collapse_spaces:bool -> ?pack:(Widget.widget -> unit) -> unit -> 'a flex
Sourceval vlfex : ?classes:string list -> ?name:string -> ?props:Props.t -> ?wdata:Widget.wdata -> ?justification:justification -> ?items_alignment:items_alignment -> ?content_alignment:content_alignment -> ?inter_space:int -> ?wrap:bool -> ?wrap_on_break:bool -> ?collapse_spaces:bool -> ?pack:(Widget.widget -> unit) -> unit -> 'a flex
OCaml

Innovation. Community. Security.