Documentation

direction

The four directions into which content can be laid out.

Possible values are:

These values are available globally and also in the direction type's scope, so you can write either of the following two:

#stack(dir: rtl)[A][B][C]
#stack(dir: direction.rtl)[A][B][C]
Preview

Definitions
Question mark

from

Returns a direction from a starting point.

View example
direction.from(left) \
direction.from(right) \
direction.from(top) \
direction.from(bottom)
Preview
direction.from() -> direction

side
alignment
Required Positional
Question mark

to

Returns a direction from an end point.

View example
direction.to(left) \
direction.to(right) \
direction.to(top) \
direction.to(bottom)
Preview
direction.to() -> direction

side
alignment
Required Positional
Question mark

axis

The axis this direction belongs to, either "horizontal" or "vertical".

View example
#ltr.axis() \
#ttb.axis()
Preview
self.axis(
) -> str

sign

The corresponding sign, for use in calculations.

View example
#ltr.sign() \
#rtl.sign() \
#ttb.sign() \
#btt.sign()
Preview
self.sign(
) -> int

start

The start point of this direction, as an alignment.

View example
#ltr.start() \
#rtl.start() \
#ttb.start() \
#btt.start()
Preview
self.start(
) -> alignment

end

The end point of this direction, as an alignment.

View example
#ltr.end() \
#rtl.end() \
#ttb.end() \
#btt.end()
Preview
self.end(
) -> alignment

inv

The inverse direction.

View example
#ltr.inv() \
#rtl.inv() \
#ttb.inv() \
#btt.inv()
Preview
self.inv(
) -> direction