Fusuma

Components / Layout

area

A column that fills the area name of the template template (the same string as the grid_areas it is in): it spans as many columns and rows as the area covers.

How it looks

Drawn by the toolkit from the example below. No page of the gallery uses area yet, so there is nothing to run.

area drawn by Fusuma

A column that fills the area name of the template template (the same string as the grid_areas it is in): it spans as many columns and rows as the area covers. A name that the template does not have gives a cell of one.

Signature

pub fn area<C>(template: &'static str, name: &str, children: C) -> Column<C>

Methods

  • .elevation(level: fusuma_ui::Elevation) -> Self — How far this lifts off the page (see elevated).
  • .padding(px: u32) -> Self — Room around the children, in pixels.
  • .gap(px: u32) -> Self — Room between the children, in pixels.
  • .width(length: Length) -> Self — The width.
  • .height(length: Length) -> Self — The height.
  • .align(align: CrossAlign) -> Self — How the children line up across the axis.
  • .min_size(w: u16, h: u16) -> Self — The least width and height (0 for none).
  • .max_size(w: u16, h: u16) -> Self — The most width and height (0 for none).
  • .margin(px: u8) -> Self — Room around this container, outside its box.
  • .justify(justify: fusuma_ui::Justify) -> Self — How the children spread along the axis when there is room left over.
  • .padding_sides(left: u8, top: u8, right: u8, bottom: u8) -> Self — Padding on each side instead of the same on all: left, top, right and bottom.
  • .margin_auto(left: bool, top: bool, right: bool, bottom: bool) -> Self — auto margins on the sides that are true (left, top, right, bottom): along the flow they take the room left over, across it they centre the child or put it at the far edge.
  • .rows(rows: Track) -> Self — Rows of a grid that are all rows tall: Track::fixed(px), or Track::fill(1) to share the height of the grid equally.
  • .min_percent(w: u8, h: u8) -> Self — A least width and height that are a percent of the room inside the parent (0 leaves a side as it is): CSS min-width: 30%.
  • .max_percent(w: u8, h: u8) -> Self — A most width and height that are a percent of the room inside the parent (0 leaves a side as it is): CSS max-width: 80%.
  • .min_content() -> Self — This child does not shrink below what its content asks for along the flow of its container (CSS min-width: auto).
  • .align_content(how: fusuma_ui::Justify) -> Self — Where the lines of a wrapping flow sit when it is taller than they are (CSS align-content).
  • .snap() -> Self — A scroll area that comes to rest with the top of a child at its top (CSS scroll-snap-type: y mandatory).
  • .dense() -> Self — A grid whose children each take the first place from the top left where they fit (CSS grid-auto-flow: row dense): a small one fills a hole an earlier row left.
  • .sticky_bottom() -> Self — Stays at the bottom of the scroll area it is in (CSS position: sticky; bottom: 0).
  • .sticky() -> Self — Stays at the top of the scroll area it is in (CSS position: sticky; top: 0).
  • .reverse() -> Self — The children run from the end (CSS row-reverse / column-reverse).
  • .width_min_content() -> Self — A paragraph or flow with no width of its own is as narrow as it can be (CSS width: min-content): a paragraph is as wide as its longest word.
  • .width_max_content() -> Self — A paragraph or flow with no width of its own is as wide as it can be (CSS width: max-content): not wrapped.
  • .width_fit_content(limit: u16) -> Self — CSS width: fit-content(limit): wrapped at limit pixels or the room it is given, whichever is less.
  • .safe() -> Self — Center and End across the flow never go past the start edge when the children do not fit (CSS safe center).
  • .first_row(first_row: Track) -> Self — A first row of its own in a grid (a header): Track::fixed(px).
  • .row_gap(gap: u32) -> Self — A gap between the lines of a wrap or the rows of a grid that differs from the one between the children in a line.
  • .basis(basis: u16) -> Self — The size this container starts from, along its parent's axis, before it takes its share of the room left (when it fills).
  • .row_span(rspan: u8) -> Self — How many rows of a grid this container covers.
  • .span(span: u8) -> Self — How many columns of a grid this container covers.
  • .pin(corner: fusuma_ui::Pin, x: i16, y: i16) -> Self — Takes this container out of its parent's flow and pins it x across and y down from corner of the parent.
  • .shrink(shrink: u8) -> Self — How much this container gives up when its parent's children do not fit (0: nothing).
  • .aspect(w: u16, h: u16) -> Self — A width-to-height ratio: the side without a length of its own follows the other.
  • .align_self(align: fusuma_ui::SelfAlign) -> Self — Where this container sits across its parent's axis, if not where the parent puts its children.
  • .justify_self(align: fusuma_ui::SelfAlign) -> Self — Where this container sits across its grid cell, if not where the grid puts its children (CSS justify-self).
  • .justify_items(align: fusuma_ui::SelfAlign) -> Self — Where the children of this grid sit in their cells (CSS justify-items).
  • .background(surface: Surface) -> Self — A background.
  • .round(round: fusuma_ui::Round) -> Self — How round the corners of the background are.

Example

use fusuma::{area, text};
let view = area("a b", "b", (text("Right half"),));
let built = fusuma::doc::built::<(), _>(&view);
assert_eq!(built.texts(), ["Right half"]);

All components · Source