struct UI::Fluid

Overview

Responsive sizing value. Translates to clamp(min, ideal, max) on web, and to the platform's idiomatic size class behavior on Apple/Android (handled by later phases).

#min, #ideal, and #max are CSS-compatible size strings (e.g., "20rem", "60vw", "480px"). Use the Fluid.px / Fluid.vw constructors when you have numeric pixel values rather than building strings by hand.

Defined in:

ui/fluid.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(min : String, ideal : String, max : String) #

[View source]
def self.px(min : Number, ideal : Number, max : Number) : Fluid #

Construct from numeric pixel values. Pixels are emitted as Npx.


[View source]
def self.vw(min_px : Number, ideal_vw : Number, max_px : Number) : Fluid #

Construct from a fluid .vw ideal with px floor/ceiling.


[View source]

Instance Method Detail

def clone #

[View source]
def copy_with(min _min = @min, ideal _ideal = @ideal, max _max = @max) #

[View source]
def ideal : String #

def max : String #

def min : String #

def to_css : String #

Render as a CSS clamp() expression.


[View source]