package toffee

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

Module Style.Flex_directionSource

CSS flex-direction property for flexbox layout.

The flex-direction property establishes the main axis of a flex container, determining the direction in which flex items are laid out. The main axis defines the primary direction of item flow, while the cross axis runs perpendicular to it.

Items are justified along the main axis and aligned along the cross axis.

Reference: CSS Flexbox Level 1

Sourcetype t =
  1. | Row
    (*

    Main axis is horizontal, left to right. Defines +x as the main axis.

    *)
  2. | Column
    (*

    Main axis is vertical, top to bottom. Defines +y as the main axis.

    *)
  3. | Row_reverse
    (*

    Main axis is horizontal, right to left. Defines -x as the main axis.

    *)
  4. | Column_reverse
    (*

    Main axis is vertical, bottom to top. Defines -y as the main axis.

    *)
Sourceval default : t

default returns Row.

Sourceval is_row : t -> bool

is_row t returns true if t is Row or Row_reverse.

Sourceval is_column : t -> bool

is_column t returns true if t is Column or Column_reverse.

Sourceval is_reverse : t -> bool

is_reverse t returns true if t is Row_reverse or Column_reverse.

main_axis t returns the absolute axis corresponding to the main axis.

  • Row and Row_reverse return Horizontal
  • Column and Column_reverse return Vertical
Sourceval cross_axis : t -> Geometry.Absolute_axis.t

cross_axis t returns the absolute axis corresponding to the cross axis.

The cross axis is always perpendicular to the main axis.

  • Row and Row_reverse return Vertical
  • Column and Column_reverse return Horizontal
Sourceval to_string : t -> string

to_string t returns the CSS string representation of t.

  • Row returns "row"
  • Column returns "column"
  • Row_reverse returns "row-reverse"
  • Column_reverse returns "column-reverse"
Sourceval equal : t -> t -> bool

equal a b returns true if a and b are the same direction.

Sourceval compare : t -> t -> int

compare a b provides a total ordering over flex directions.

Sourceval pp : Format.formatter -> t -> unit

pp fmt t pretty-prints t to fmt using its CSS string representation.