NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2686 most downloaded on crates.io
A flexible UI layout library
Last release 1 months ago
24 Aug 2026
Release timing varies
gaps range from 2 weeks to 4 months
Nearly every release is documented
notes for 59 of 59 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
63 releases · first in 2022
One column per quarter.
The MSRV for this release is 1.71.
The MSRV for this release is 1.71.
The width, height and flex-basis properties now support min-content, max-content, fit-content, fit-content(), and stretch keywords.
flex-basis additionally supports the content keyword. The min-width/max-width (and height) properties have been switched to use LengthPercentageAuto
rather than Dimension, as they do not yet support these keywords.
flex-wrap: balance (#1105)Taffy now supports flex-wrap: balance and flex-line-count from CSS Flexbox Level 2, behind the default flexbox_balance feature.
See Balancing Text in CSS: The Flex-Wrap Last Row Problem for an explainer.
The layout effects of contain: layout, contain: paint, and contain: content are now supported, including independent formatting contexts, baseline suppression, and overflow containment. contain: size is not yet supported.
DetailedGridTracksInfo's gutters and sizes fields are replaced by a single positions vec. positions contains the offset of every grid line in theDetailedGridTracksInfo is now stored in logical order (so right-to-left for direction: rtl grids)DetailedGridInfo::resolve_absolute_grid_area which can resolve a grid area for an item given it's position styles. This is useful for positioninggrid_template_rows and grid_template_columns methods which serialize those properties into a string according to the CSS standard.Caching logic is now more correct (#1010, #1155)
expand() methods that expose their values as plain enums (#1129).Layout::content_size is now scrollable_overflow_rect: Rect<f32>. Its right and bottom fields replace the old width and height values; scroll_width() and scroll_height() are unchanged (#1118).LayoutOutput::first_baselines is now baselines: Baselines, with first and last baseline fields (#1107).Style::min_size and max_size now use LengthPercentageAuto rather than Dimension (#1099).compute_layout_with_measure now passes a LayoutInput and returns LayoutOutput; call compute_leaf_layout explicitly to preserve the old leaf-measurement behaviour (#1091).CacheTree::cache_get and Cache::get now take &mut self, and the measure cache uses second-chance (clock) eviction (#1010).clear when computing the intrinsic width of floats (#1150).grid-template-rows and grid-template-columns (#1138).min-height determines the used height (#1082).normal align-content to formatting contexts and floated children (#1087, #1089).justify-content after auto margins consume it (#1115).TaffyTree::remove now marks the former parent dirty (#1085).The MSRV for this release is 1.71.
The MSRV for this release is 1.71.
Support for the self-start and self-end alignment keywords (AlignItems::SELF_START/SELF_END and safe variants). These resolve against the direction of the item itself rather than that of its container, so they only differ from start/end when the item's direction differs from its container's. Supported for align-self/align-items and justify-self/justify-items on both in-flow and absolutely positioned Flexbox and Grid items (#1074)
Support for display: flow-root. The new Display::FlowRoot variant lays out children using the block layout algorithm but always establishes a new block formatting context (its margins do not collapse with those of its children, it contains its own floats, and it avoids external floats)
length, percent, fr, flex) now accept Input: Into<f64> instead of Input: Into<f32>. This allows bare float literals such as length(800.0) to be used without triggering the float_literal_f32_fallback future-compatibility lint, while widening the set of accepted numeric input types (#974)grid_template_areas is now Option<GridTemplateAreas<S>>, where the new GridTemplateAreas struct includes row_count/column_count fields. This allows templates containing unnamed (.) cells beyond the extents of the named areas (e.g. grid-template-areas: "a .") to be represented.BlockContext::place_floated_box takes an additional adjoins_unresolved_strut: bool parameter indicating whether the float is being placed while the position of the current margin-collapse strut is still unresolvedA large number of miscelaneous bug fixes are included in this release:
justify-content: start/end and align-self: start/end/self-start/self-end as writing-mode relative (rather than flex-relative) in the static position of absolutely positioned children; use the flex-relative start for justify-content: space-between/normal, and a fallback of start for align-self: baseline (#1072)auto margins on absolutely positioned children absorb free space when the box is inset-constrained in that axis; otherwise they resolve to zero per CSS2 §10.3.7/§10.6.4 (#1072)align-content/justify-content is not included in the abspos grid area (#1071)auto (#1075)max-content (or fit-content()) (#1033)Layout::content_size from the container's padding-box origin and include the container's own end-side padding, matching Flexbox and browser scrollWidth/scrollHeight semantics. Grid items in tracks that overflow the container now also contribute their position within the container, not just their own size (#1051)clear as a no-op when no float has been placed on the relevant side(s) (#1041)clear past zero-sized floats, which occupy no float segment and so were previously ignored when positioning later floats and cleared elements (#1056)The MSRV for this release is 1.71.
Taffy now supports self-start and self-end alignment for in-flow and absolutely positioned Flexbox and Grid items. Unlike start and end, these values resolve against the item's own writing direction rather than its container's.
display: flow-root (#997)display: flow-root uses Block layout while always establishing an independent formatting context.
Into<f64> rather than Into<f32> (#983).grid_template_areas is now Option<GridTemplateAreas<S>>, where the new GridTemplateAreas struct includes row_count/column_count fields. This allows templates containing unnamed (.) cells beyond the extents of the named areas (e.g. grid-template-areas: "a .") to be represented (#1024).BlockContext::place_floated_box now indicates whether it adjoins an unresolved margin-collapse strut (#1046).wrap-reverse alignment (#987, #995, #996).Block: return margin-collapsing outputs from vertical axis ComputeSize calls
This release container a couple of critical fixes for layout/caching bugs in the 0.12.0 release.
This release container a couple of critical fixes for layout/caching bugs in the 0.12.0 release.
The MSRV for this release is 1.71.
The MSRV for this release is 1.71.
align-content (#959)Block containers now implement align_content along the block axis for their in-flow children.
align-self of start on absolute-position overflow (#958)aspect-ratio at final layout. A block container with aspect-ratio and an automatic height now becomes definite when its width is filled/stretched, so children's percentage heights resolve correctly and the ratio is preserved (#965)The MSRV for this release is 1.71.
The MSRV for this release is 1.71.
Taffy now implements safe alignment (in addition to unsafe alignment).
The alignment style types are now structs consisting of an AlignmentKeyword and an AlignmentSafety modifier. For most users this will mean changing from using enum variants like AlignContent::Start to associated constants like AlignContent::START.
This change applies to the AlignContent, JustifyContent, AlignItems, JustifyItems, AlignSelf, and JustifySelf types.
Nothing published for this version
Nothing published for this version
CSS Grid auto-repeat and minimum-size handling
Nothing published for this version
The MSRV for this release is 1.71.
The MSRV for this release is 1.71.
directionThe direction property is now supported, allowing for RTL layout of boxes in Block, Flexbox, and CSS Grid layout modes.
The float and clear properties are now supported. Support consists of a general-purpose FloatContext in the compute module, and integration of float layout into Block layout. Block layout now also has a BlockContext that allows a FloatContext to be shared across an entire Block formatting context.
Float support is feature flagged by the float_layout feature.
All of Taffy's style types (except the top-level Style struct) now have FromStr implementations that parses the type from the CSS representation of that value (e.g. 30px or 50% for LengthPercentage. A future version of Taffy will likely add support for parsing Style from ;-seperated CSS.
CSS parsing is feature flagged by the parse feature.
DetailedGridTracksInfo struct accessible from a public module (#899)TaffyTree::write_tree method to debug print the tree into an arbitrary writer (#925)set and set APIs now take &LayoutInput rather than individual values (#933)The MSRV for this release is 1.71.
directionThe direction property is now supported, allowing for RTL layout of boxes in Block, Flexbox, and CSS Grid layout modes.
The float and clear properties are now supported. Support consists of a general-purpose FloatContext in the compute module, and integration of float layout into Block layout. Block layout now also has a BlockContext that allows a FloatContext to be shared across an entire Block formatting context.
Float support is feature flagged by the float_layout feature.
All of Taffy's style types (except the top-level Style struct) now have FromStr implementations that parses the type from the CSS representation of that value (e.g. 30px or 50% for LengthPercentage. A future version of Taffy will likely add support for parsing Style from ;-seperated CSS.
CSS parsing is feature flagged by the parse feature.
Additionally the parse_faster feature enables optimizations for faster parsing at the cost of pulling in proc-macro dependencies such as syn.
TaffyTree::write_tree method to debug print the tree into an arbitrary writer (#925)set and set APIs now take &LayoutInput rather than individual values (#933)Fix wrong size propogation for absolute elements
Flexbox: don't apply cross-axis stretch alignment to children with auto margins
Support for named grid lines and grid areas
Taffy now supports named grid lines and areas.
As these rely on arbitrary user-provided strings, Taffy's Style struct is now generic
over a string-like type (via the CheapCloneStr trait). Additionally as the grid feature is optional,
it has a PhantomData field of that type to make type inference work.
PrintTree and RoundTree: use Layout instead of &Layout (#849).TrackSizingFunction to GridTemplateComponentNonRepeatedTrackSizingFunction to TrackSizingFunctionRepeat variant of GridTemplateComponent now contains a new GridTemplateRepetition struct, which allowsGridTemplateArea struct and Style::grid_template_areas fieldStyle::grid_template_column_names and Style::grid_template_row_names fields. If non-empty, thesegrid_template_column/grid_template_rows style.Fix serde feature on 32bit targets
serde feature on 32bit targets (#845)Fix: Calculate correct new grid size when expanding cell_occupancy_matrix in the negative direction
Impl GridItemStyle and BlockContainerStyle for Style (#832).
GridItemStyle and BlockContainerStyle for Style (#832).The big feature in this release is support for `calc()` values in the low-level API.
The big feature in this release is support for calc() values in the low-level API.
To use this API:
resolve_calc_value method when implementing the LayoutPartialTree trait.*const ()) to constructors like LengthPercentage::calc(...)Taffy treats the pointer as an opaque value (excepting that it uses the low 3 bits as a tag) which it will
pass to LayoutPartialTree::resolve_calc_value along with a percentage resolution basis when it needs to
resolve the value.
calc().
The effected types are LengthPercentage, LengthPercentageAuto, Dimension, MinTrackSizingFunction, and
MaxTrackSizingFunction types.Add #[inline] annotation to some methods on TaffyTree
#[inline] annotation to some methods on TaffyTree (#802)TaffyTree::remove_children_range method (#802)Fix infinite loop due to float precision in grid layout maximise tracks step
Grid: only stretch auto tracks if content-alignment is stretch
Fix detailed grid info for empty grid
Make TaffyTree::detailed_layout_info take &self rather than &mut self
TaffyTree::detailed_layout_info take &self rather than &mut self (#779)The ability to access computed track sizes and item positions of a CSS Grid layout (#772). This information can be accessed using the LayoutGridContai
LayoutGridContainer::set_detailed_grid_info method
in the low-level API or the TaffyTree::detailed_layout_info method in the high-level API.Improve interaction of abspos children of block containers with margin collapsing
TaffyTree::unrounded_layout getter (#765)num-traits dependency was removed (#761) (#762)BREAKING: The cache_mut method on the LayoutPartialTree trait has been replaced with a separate CacheTree trait. This allows Taffy to be more easily u
cache_mut method on the LayoutPartialTree trait has been replaced with a separate CacheTree trait. This allows
Taffy to be more easily used without caching or with a custom cache implementation.TaffyTree::set_children method now removes the children from their previous parent (if they have one).LayoutBlock: ignore margin collapsing when computing static position of abspos items
Fix: clamp indefinite available space by min- and max- size as appropriate
Fix calculation of auto-fill/auto-fit repetition count when container has a definite percentage size
auto-fill/auto-fit repetition count when container has a definite percentage size (#722)The Style struct has been "traitified". This supports Taffy's integration in Servo and generally makes Taffy more flexible. The Style struct still exi
Style struct has been "traitified". This supports Taffy's integration in Servo and generally makes Taffy more flexible. The
Style struct still exists and implements the new traits so existing uses of Taffy will continue to work as before.box-sizing style is supportedLayoutprint_tree() when rounding is disabled (#680)<center> and <div align="..">) is supportedis_table for block items (#701)Debug and Clone for Cache (#688)Debug and PartialEq for tree types (#697)Fix block stretch sizing (don't always apply stretch sizing to block containers)
Fix: Clamp block item stretch widths by their min and max width
The changes in 0.5 are relatively small but the new measure function parameter is a breaking change so it requires a minor version bump.
The changes in 0.5 are relatively small but the new measure function parameter is a breaking change so it requires a minor version bump.
style: &Style parameter has been added to measure functions.MaybeMath, MaybeResolve, and ResolveOrZero traits have been made public.Content alignment (align-content/justify-content) behaviour was updated to match the latest spec (and Chrome 123+)
align-content/justify-content) behaviour was updated to match the latest spec (and Chrome 123+) (#635)Fix compilation error in evenly_sized_tracks style helper in recent versions of rustc caused by a change/regression in type inference (#643). Note tha
evenly_sized_tracks style helper in recent versions of rustc caused by a change/regression in type
inference (#643). Note that 3rd-party code that call style helpers that take an Into<f32> parameter may still be affected by this issue,
but they should be able to fix on their side by clarifying the type passed inFixed: single-line flex-container should clamp the line's cross-size
Fixed: CSS Grid track sizing not respecting growth limits in some circumstances
Support for CSS Block layout (display: block)
display: block)overflow property (+ scrollbar_width for overflow: scroll)padding and border are now output into the Layout structSupport for CSS Block layout has been added. This can be used via the new Display::Block variant of the Display enum. Note that full flow layout: inline, inline-block and float layout have not been implemented. The use case supported is block container nodes which contain block-level children.
Support has been added for a new overflow style property with Visible, Clip, Hidden, and Scroll values (Auto is not currently implemented). Additionally a scrollbar_width property has been added to control the size of scrollbars for nodes with Overflow::Scroll set.
Visible and Clip will produce layouts equivalent to the Taffy 0.3. Clip will affect the new content_size output by restricting it to the available space.Hidden and Scroll affect layout by changing the automatic minimum size of Flexbox and Grid childrenScroll additionally reserves scrollbar_width pixels for a scrollbar in the opposite axis to which scrolling is enabled. Scroll with scrollbar_width set to zero is equivalent to Hidden.The "measure function" API for integrating Taffy with other measurement systems (such as text layout) has been changed to be more flexible and to interact better with borrow checking (you can now borrow external data in your measure function!).
Taffy tree is now a generic TaffyTree<T> where T is the "context" type.Size::ZERO for leaf nodes whose context is None.If you are not using measure functions, then the only change you will need to make is from:
let mut tree = Taffy::new();
to
let mut tree : TaffyTree<()> = TaffyTree::new();
And generally update any uses of Taffy in your codebase to TaffyTree<()>.
If you are using measure functions then you will need to make some bigger (but straightforward) changes. The following Taffy 0.3 code:
let mut tree = Taffy::new();
let leaf = tree.new_leaf_with_measure(
Style::DEFAULT,
|known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>| Size { width: 100.0, height: 200.0 }
);
tree.compute_layout(leaf, Size::MAX_CONTENT);
Should become something like the following with Taffy 0.4:
let mut tree : TaffyTree<Size> = TaffyTree::new();
let leaf = tree.new_leaf_with_context(Style::DEFAULT, Size { width: 100.0, height: 200.0 });
tree.compute_layout_with_measure(
leaf,
Size::MAX_CONTENT,
|known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, node_id: NodeId, node_context: Option<Size>| {
node_context.unwrap_or(Size::ZERO)
}
);
Note that:
Size in the above example. This includes your own custom type (which can be an enum or a trait object).() for the context typecompute_layout_with_measure only needs to exist for the duration of a single layout run,
it can (mutably) borrow data from it's environmentLayoutTree trait) refactorThe low-level API has been completely reworked:
LayoutTree trait has been split into 5 smaller traits which live in the taffy::tree:traits module (along with their associated documentation)LayoutTree traits entirely: parent, is_childless, measure_node, needs_measure, and mark_dirty.taffy::node::Node has been replaced with taffy::NodeId. This should make it much easier to implement the low-level traits as the underlying type backing the node id now a u64 rather than a slotmap::DefaultKey.compute_flexbox_layoutcompute_grid_layoutcompute_block_layoutcompute_leaf_layoutcompute_root_layoutcompute_hidden_layoutIt is believed that nobody was previously using the low-level API so we are not providing a migration guide. However, along with the refactor we have greatly improved both the documentation and have added examples using the new API, both of which are linked to from the main documentation page.
The specific changes are detailed below. However for most users the most significant change will be that almost all types are now re-exported from the root module. This means that module specific imports like use taffy::layout::Layout can now in almost all cases be replaced with the simpler use taffy::Layout.
Specific changes:
math module has been made privateaxis module has been merged into the geometry moduleprint_tree function is now accessible under util.node, data, layout, error and cache modules have been moved to the the tree module.layout_flexbox() function has been removed from the prelude. Use taffy::compute_flexbox_layout instead.points or Points with length or LengthThis new name better describes one-dimensional measure of space in some unspecified unit
which is often unrelated to the PostScript point or the CSS pt unit.
This also removes a misleading similarity with the 2D Point,
whose components can have any unit and are not even necessarily absolute lengths.
Example usage change:
use taffy::prelude::*;
// …
let header_node = taffy
.new_leaf(
Style {
- size: Size { width: points(800.0), height: points(100.0) },
+ size: Size { width: length(800.0), height: length(100.0) },
..Default::default()
},
).unwrap();
Taffy type was renamed to TaffyTree and made generic of a context parameterflexbox feature. The flexbox feature is enabled by default.justify_self property has been moved behind the grid feature.RunMode::PeformLayout renamed into RunMode::PerformLayout (added missing r).serde dependency has been made compatible with no_std environmentsslotmap dependency has been made compatible with no_std environmentsinsert_child_at_index() method to the TaffyTree. This can be used to insert a child node at any position instead of just the end.total_node_count() method to the TaffyTree which returns the total number of nodes in the tree.get_disjoint_node_context_mut() method to the TaffyTree. This can be used to safely get multiple mutable borrows at the same time.Fix compilation error in evenly_sized_tracks style helper in recent versions of rustc caused by a change/regression in type inference (#643). Note tha
evenly_sized_tracks style helper in recent versions of rustc caused by a change/regression in type
inference (#643). Note that 3rd-party code that call style helpers that take an Into<f32> parameter may still be affected by this issue,
but they should be able to fix on their side by clarifying the type passed inFix computation of Flexbox automatic minimum size when grid or flexbox child has an explicit width/height style set
Added total_node_count method to the Taffy struct. Returns the total number of nodes in the tree.
total_node_count method to the Taffy struct. Returns the total number of nodes in the tree.Improve performance of flexbox columns
Fix justify-content and align-content when free space is negative (content overflows container)
Flex: Fix issue where constraints were not being propagated, causing nodes with inherent aspect-ratio (typically images) to not apply that aspect-rati
Fix rounding accumulation bug (#521) (Fixes #501 and bevyengine/bevy#8911)
Fix rounding accumulation bug (#521) (Fixes #501 and bevyengine/bevy#8911)
Flexbox: pass correct cross-axis available space when computing an item's intrinsic main size (#522)(Fixes bevyengine/bevy#9350)
Flexbox: Subtract child margin not parent margin when computing stretch-alignment known size
Grid: Make CSS Grid algorithm correctly apply max width/height and available space when it is the root node (#491)
Grid: Fix CSS Grid "auto track" / placement bugs #481
Leaf: Apply margins to leaf nodes when computing available space for measure functions
Leaf: Reserve space for padding/borders in nodes with measure functions (#497)
NOTE: This has the potential to break layouts relying on the old behaviour. However, such layouts would be relying on a style having no effect, so it is judged that such layouts are unlikely to exist in the wild. If this turns out not to be true then this fix will be reverted on the 0.3.x branch.
grid to 0.10. This eliminates the transitive dependency on no-std-compat.Fix caching issue when toggling display:none on and off
display:none on and offFix exponential blowup when laying out trees containing nodes with min and max sizes.
Fix sizing of children when the available_space < min_size
Fix caching bug where a cached result would sometimes be incorrectly used when the amount of available space increased (bevyengine/bevy#8111) and (bev
Fix incorrect min-content size for flex-wrap: wrap nodes (bevyengine/bevy#8082)
flex-wrap: wrap nodes (bevyengine/bevy#8082)Fix: Make padding and border floor node sizes
padding and border floor node sizes (#372)Fix: Ignore align_content when flex_wrap is set to nowrap
align_content when flex_wrap is set to nowrap (#383)Fix display: none when it is set on a flexbox child
display: none when it is set on a flexbox child (#380)display: none when it is set on a grid child (#381)Fix display: none when it is set for the only node in the hierarchy
display: none when it is set for the only node in the hierarchy (#377)Added enable_rounding and disable_rounding methods to the Taffy struct which enable consumers of Taffy to obtain unrounded f32 values for the computed
enable_rounding and disable_rounding methods to the Taffy struct which enable consumers of Taffy to obtain unrounded f32 values for the computed layouts if they want them. Rounding remains enabled by default.grid feature disabled (#370)std feature disabledAllow partial nested values to be deserialized into a Style using the serde feature.
Style using the serde feature.The serde feature now works when the grid feature is enabled
serde feature now works when the grid feature is enabledSee below for details of breaking changes.
See below for details of breaking changes.
We very excited to report that we now have support for CSS Grid layout. This is in addition to the existing Flexbox layout support, and the two modes interoperate. You can set a node to use Grid layout by setting the display property to Display::Grid.
Taffy implements the CSS Grid specification faithfully, so documentation designed for the web should translate cleanly to Taffy's implementation. If you are interested in learning how to use CSS Grid, we would recommend the following resources:
In addition to the usual sizing/spacing properties (size, min_size, padding, margin, etc), the following Grid style properties are supported on Grid Containers:
| Property | Explanation |
|---|---|
grid-template-columns |
The track sizing functions of the grid's explicit columns |
grid-template-rows |
The track sizing functions of the grid's explicit rows |
grid-auto-rows |
Track sizing functions for the grid's implicitly generated rows |
grid-auto-columns |
Track sizing functions for the grid's implicitly generated columns |
grid-auto-flow |
Whether auto-placed items are placed row-wise or column-wise. And sparsely or densely. |
gap |
The size of the vertical and horizontal gaps between grid rows/columns |
align-content |
Align grid tracks within the container in the inline (horizontal) axis |
justify-content |
Align grid tracks within the container in the block (vertical) axis |
align-items |
Align the child items within their grid areas in the inline (horizontal) axis |
justify-items |
Align the child items within their grid areas in the block (vertical) axis |
And the following Grid style properties are supported on Grid Items (children):
| Property | Explanation |
|---|---|
grid-row |
The (row) grid line the item starts at (or a span) |
grid-column |
The (column) grid line the item end at (or a span) |
align-self |
Align the item within it's grid area in the inline (horizontal) axis. Overrides align-items. |
justify-self |
Align the item within it's grid area in the block (vertical) axis. Overrides justify-items. |
The following properties and features are not currently supported:
grid-template-areas and grid-areagrid-template or grid shorthandSee examples/grid_holy_grail.rs for an example using Taffy to implement the so-called Holy Grail Layout. If you want to run this example, the don't forget the enable the CSS Grid cargo feature:
cargo run --example grid_holy_grail --features grid
Ten new helper functions have added to the taffy prelude. These helper functions have short, intuitive names, and have generic return types which allow them to magically return the correct type depending on context. They make defining styles much easier, and means you won't typically need to use types like Dimension or TrackSizingFunction directly.
For example, instead of:
let size : Size<Dimension> = Size { width: Dimension::Points(100.0), height: Dimension::Percent(50.0) };
you can now write
let size : Size<Dimension> = Size { width: points(100.0), height: percent(50.0) };
And that same helper function will work other types like LengthPercentage and MinTrackSizingFunction that also have a Points variant. There are also generic impl's for Size<T>, Rect<T> and Line<T> which means if your node is the same size in all dimensions you can even write
let size : Size<Dimension> = points(100.0);
Available style helpers:
<table> <thead><tr><th>Type(s)</th><th colspan="2">Helpers that work with that type</th></tr></thead> <tbody> <tr> <td rowspan="3"><code>LengthPercentage</code></td> <td><code>zero()</code></td> <td>Generates a <code>Points</code> variant with the value <code>0.0</code></td> </tr> <tr> <td><code>points(val: f32)</code></td> <td>Generates a <code>Points</code> variant with the specified value</td> </tr> <tr> <td><code>percent(val: f32)</code></td> <td>Generates a <code>Percent</code> variant with the specified value.<br />Note that the scale of 0-1 not 0-100.</td> </tr> <tr> <td rowspan="2"><code>LengthPercentageAuto</code><br /><code>Dimension</code></td> <td colspan="2"><i>All helpers from <code>LengthPercentage</code> and...</i></td> </tr> <tr> <td><code>auto()</code></td> <td>Generates an <code>Auto</code> variant</td> </tr> <tr> <td rowspan="3"><code>MinTrackSizingFunction</code></td> <td colspan="2"><i>All helpers from <code>LengthPercentageAuto</code>/<code>Dimension</code> and...</i></td> </tr> <tr> <td><code>min_content()</code></td> <td>Generates an <code>MinContent</code> variant</td> </tr> <tr> <td><code>max_content()</code></td> <td>Generates an <code>MinContent</code> variant</td> </tr> <tr> <td rowspan="3"><code>MaxTrackSizingFunction</code></td> <td colspan="2"><i>All helpers from <code>MinTrackSizingFunction</code> and...</i></td> </tr> <tr> <td><code>fit_content(limit: LengthPercentage)</code></td> <td>Generates a <code>FitContent</code> variant with the specified limit.<br />Nest the <code>points</code> or <code>percent</code> helper inside this function to specified the limit.</td> </tr> <tr> <td><code>fr(fraction: f32)</code></td> <td>Generates a <code>Fraction</code> (<code>fr</code>) variant with the specified flex fraction </td> </tr> <tr> <td rowspan="3"><code>NonRepeatingTrackSizingFunction</code></td> <td colspan="2"><i>All helpers from <code>MaxTrackSizingFunction</code> and...</i></td> </tr> <tr> <td><code>minmax(min: MinTrackSizingFunction, max: MaxTrackSizingFunction)</code></td> <td>Equivalent to CSS <code>minmax()</code> function.</td> </tr> <tr> <td><code>flex(fraction: f32)</code></td> <td>Equivalent to CSS <code>minmax(0px, 1fr)</code>. This is likely what you want if you want evenly sized rows/columns.</td> </tr> <tr> <td rowspan="2"><code>TrackSizingFunction</code></td> <td colspan="2"><i>All helpers from <code>NonRepeatingTrackSizingFunction</code> and...</i></td> </tr> <tr> <td><code>repeat(rep: GridTrackRepetition, tracks: Vec<TrackSizingFunction>)</code></td> <td>Equivalent to css <code>repeat()</code> function.</td> </tr> <tr> <td><code>Vec<TrackSizingFunction></code></td> <td><code>evenly_sized_tracks(count: u16)</code></td> <td>Equivalent to CSS <code>repeat(count, minmax(0px, 1fr)</code></td> </tr> <tr> <td rowspan="3"><code>AvailableSpace</code></td> <td><code>auto()</code></td> <td>Generates an <code>Auto</code> variant</td> </tr> <tr> <td><code>min_content()</code></td> <td>Generates an <code>MinContent</code> variant</td> </tr> <tr> <td><code>max_content()</code></td> <td>Generates an <code>MinContent</code> variant</td> </tr> <tr> <td><code>Size<T></code></td> <td colspan="2">Any helper that works for <code>T</code> will also work for <code>Size<T></code> and will set both <code>width</code> and <code>height</code> to that value</td> </tr> <tr> <td><code>Rect<T></code></td> <td colspan="2">Any helper that works for <code>T</code> will also work for <code>Rect<T></code> and will set <code>top</code>, <code>left</code>, <code>bottom</code>, and <code>right</code> to that value</td> </tr> </tbody> </table>
AlignContent and JustifyContent has been merged.
JustifyContent is now an alias of AlignContent and contains the Stretch variant.Start) when applied Flexbox containers. It is valid value for Grid containers.AlignItems and AlignSelf have been merged.
Auto variant of AlignSelf has been removed. You should now use Option::None if you wish to specify AlignSelf::Auto.AlignSelf is now an alias of AlignItems.JustifyItems and JustifySelf aliases have been added. These properties have no affect on Flexbox containers, but apply to Grid containers.Default impls have been removed from all alignment types. This is because the correct default varies by property, and the types are now shared between multiple properties. The Style struct still has a default for each alignment property, so this is considered unlikely to affect you in practice.LengthPercentage and LengthPercentageAuto have been added.
LengthPercentage is like Dimension but only contains the Points and Percent variants, which allows us to increase type safety for properties that don't support the Auto value.LengthPercentageAuto is currently identical to Dimension but will allow us to expand dimension in future to support values like MinContent, MaxContent and FitContent.LengthPercentage or LengthPercentageAuto instead of Dimension. You will need to update your code, but it is recommended that you use the new style helpers (see above) rather than using the new types directly (although you certainly can use them directly if you want to).position property is now renamed to inset and is now in line with CSS inset specsposition_type property is now renamed to position and is now in line with CSS position specs. The PositionType enum has been similarly renamed to Position.LayoutTreeLayoutTree for a ChildIter, an iterator on the children of a given node.children method of LayoutTree to return the ChildIter generic associated type to allow for custom tree storage implementations which do not store the children of a node contiguously.child_count method to LayoutTree for querying the number of children of a node. Required because the children method now returns an iterator instead of an array.is_childless method to LayoutTree for querying whether a node has no children.AvailableSpace has been movedThe AvailableSpace enum has been moved from the layout module to the style module. If you are importing it via the prelude then you will unaffected by the change.
top and bottom or left and right were specified (#348)top_from_points, bot_from_points, top_from_percent, and bot_from_percent methods removed from Rect<Dimension>. These functions were incredibly specific for an unusual use case, so we would be surprised if anyone was using them. Please use the new style helpers instead.min_main_size, max_main_size, min_cross_size, max_cross_size, and cross_size methods from Style. Use the more general cross and main methods directly on the size, min_size, and max_size properties instead.main_margin_start, main_margin_end, cross_margin_start, cross_margin_end from Style. Use the more general main_start, main_end, cross_start, and cross_end on the margin property instead.Nothing published for this version
Border or padding on the horizontal axis could, in some cases, increase the height of nodes.
Your coding agent can read these notes before it upgrades. Set up the MCP server →