#[non_exhaustive]pub enum CssValue {
}Expand description
A closed union of typed CSS component values.
This type is useful for storing heterogeneous primitives. It is not a declaration grammar: property-specific APIs accept narrower types and are the only values that integrate directly with Leptos style attributes.
§Ergonomics
Use the free convenience functions for common values:
use leptos_css::{px, em, rem, pct, deg};
let width = px(100);
let margin = em(0.6);
let offset = pct(50);
let rotation = deg(45);Arbitrary strings and unchecked function bodies are intentionally absent. Unsupported CSS must be written outside this typed API until its grammar is modeled.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Number(FiniteF64)
A bare floating-point number (e.g., opacity, flex-grow).
Integer(i32)
A bare integer (e.g., z-index, order).
Length(CssLength)
A CSS length value (px, em, rem, vh, vw, etc.).
Percent(FiniteF64)
A percentage value.
Angle(CssAngle)
A CSS angle value (deg, rad, turn, grad).
Time(CssTime)
A CSS time value (s, ms).
Color(CssColor)
A CSS color value (rgb, rgba, hsl, hsla, named).
Fr(NonNegativeFiniteF64)
Fractional units for CSS Grid (e.g., 1fr).
Auto
The CSS auto keyword.
Zero
Zero with unit for calc() compatibility. Renders as "0px".
Inherit
The CSS inherit keyword.
Initial
The CSS initial keyword.
Unset
The CSS unset keyword.
Revert
The CSS revert keyword.
RevertLayer
The CSS revert-layer keyword.
Trait Implementations§
Source§impl CssWriteTo for CssValue
impl CssWriteTo for CssValue
Source§impl From<CssDimension> for CssValue
impl From<CssDimension> for CssValue
Source§fn from(dim: CssDimension) -> Self
fn from(dim: CssDimension) -> Self
Source§impl From<GlobalKeyword> for CssValue
impl From<GlobalKeyword> for CssValue
Source§fn from(keyword: GlobalKeyword) -> Self
fn from(keyword: GlobalKeyword) -> Self
impl StructuralPartialEq for CssValue
Auto Trait Implementations§
impl Freeze for CssValue
impl RefUnwindSafe for CssValue
impl Send for CssValue
impl Sync for CssValue
impl Unpin for CssValue
impl UnsafeUnpin for CssValue
impl UnwindSafe for CssValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> CheckedCssValue for Twhere
T: CssWriteTo + Sealed,
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more