Skip to content

Type safety for properties that take a CSS length

Compare
Choose a tag to compare
@Jarvis1010 Jarvis1010 released this 09 Feb 20:31
· 1756 commits to main since this release

Up until now, props that accepted a CSS length as a string never had any proper type-safety. For example, one could set the minItemWidth to 100jibjabs on the Grid component and nothing would warn you that this is incorrect.

Luckily that is in our past. Bedrock has adopted much better type-safe types for anything that should be a CSS length. Now props, like Grid's minItemWidth prop, will show an error if the format of the string isn't either <number><CSS unit | percentage> or var(<custom prop name>). The following components will have adopted this:

Grid -> minItemWidth
ColumnDrop -> basis
Center -> maxWidth
Cover -> minHeight

What's Changed

Full Changelog: https://github.com/Bedrock-Layouts/Bedrock/commits/@bedrock-layout/[email protected]