Skip to main content

Style

Struct Style 

Source
pub struct Style {
Show 63 fields pub position: Option<Position>, pub top: Option<Dim>, pub right: Option<Dim>, pub bottom: Option<Dim>, pub left: Option<Dim>, pub margin: Option<Lp>, pub margin_x: Option<Lp>, pub margin_y: Option<Lp>, pub margin_top: Option<Lp>, pub margin_right: Option<Lp>, pub margin_bottom: Option<Lp>, pub margin_left: Option<Lp>, pub padding: Option<Lp>, pub padding_x: Option<Lp>, pub padding_y: Option<Lp>, pub padding_top: Option<Lp>, pub padding_right: Option<Lp>, pub padding_bottom: Option<Lp>, pub padding_left: Option<Lp>, pub flex_direction: Option<FlexDir>, pub flex_wrap: Option<FlexWrap>, pub flex_grow: Option<f32>, pub flex_shrink: Option<f32>, pub flex_basis: Option<Dim>, pub align_items: Option<Align>, pub align_self: Option<Align>, pub align_content: Option<ContentAlign>, pub justify_content: Option<ContentAlign>, pub width: Option<Dim>, pub height: Option<Dim>, pub min_width: Option<Dim>, pub min_height: Option<Dim>, pub max_width: Option<Dim>, pub max_height: Option<Dim>, pub aspect_ratio: Option<f32>, pub display: Option<Display>, pub border_style: Option<BorderStyle>, pub border_top: Option<bool>, pub border_right: Option<bool>, pub border_bottom: Option<bool>, pub border_left: Option<bool>, pub gap: Option<f32>, pub column_gap: Option<f32>, pub row_gap: Option<f32>, pub text_wrap: Option<TextWrap>, pub overflow_x: Option<Overflow>, pub overflow_y: Option<Overflow>, pub background_color: Option<String>, pub border_color: Option<String>, pub border_top_color: Option<String>, pub border_right_color: Option<String>, pub border_bottom_color: Option<String>, pub border_left_color: Option<String>, pub border_background_color: Option<String>, pub border_top_background_color: Option<String>, pub border_right_background_color: Option<String>, pub border_bottom_background_color: Option<String>, pub border_left_background_color: Option<String>, pub border_dim_color: Option<bool>, pub border_top_dim_color: Option<bool>, pub border_right_dim_color: Option<bool>, pub border_bottom_dim_color: Option<bool>, pub border_left_dim_color: Option<bool>,
}
Expand description

The layout style for a DOM node.

Mirrors ink’s Styles type (styles.ts) with every prop that ink’s apply* functions write to yoga (styles.ts:415–777). Layout-inert props (text color, background, border colors) are carried as raw strings for the renderer (M1-5) without influencing the taffy layout pass.

§Shorthand resolution

  • overflow shorthand: resolved JS-side in Box.tsx before setStyle — only overflow_x/overflow_y per-axis values reach Rust.
  • margin/marginX/marginY, padding/paddingX/paddingY, gap shorthands: NOT resolved JS-side (yoga handles via EDGE_ALL / GUTTER_ALL). Rust carries these shorthands; the taffy mapping collapses them with an Option::or cascade.

Fields§

§position: Option<Position>§top: Option<Dim>§right: Option<Dim>§bottom: Option<Dim>§left: Option<Dim>§margin: Option<Lp>

Shorthand — applies to all four edges (yoga EDGE_ALL).

§margin_x: Option<Lp>

Horizontal shorthand — left + right (yoga EDGE_HORIZONTAL).

§margin_y: Option<Lp>

Vertical shorthand — top + bottom (yoga EDGE_VERTICAL).

§margin_top: Option<Lp>§margin_right: Option<Lp>§margin_bottom: Option<Lp>§margin_left: Option<Lp>§padding: Option<Lp>

Shorthand — applies to all four edges.

§padding_x: Option<Lp>

Horizontal shorthand — left + right.

§padding_y: Option<Lp>

Vertical shorthand — top + bottom.

§padding_top: Option<Lp>§padding_right: Option<Lp>§padding_bottom: Option<Lp>§padding_left: Option<Lp>§flex_direction: Option<FlexDir>§flex_wrap: Option<FlexWrap>§flex_grow: Option<f32>§flex_shrink: Option<f32>§flex_basis: Option<Dim>

flexBasis — yoga accepts number (points), percent string, or auto.

§align_items: Option<Align>§align_self: Option<Align>

None encodes auto (taffy has no explicit AlignSelf::Auto variant).

§align_content: Option<ContentAlign>§justify_content: Option<ContentAlign>§width: Option<Dim>§height: Option<Dim>§min_width: Option<Dim>§min_height: Option<Dim>§max_width: Option<Dim>§max_height: Option<Dim>§aspect_ratio: Option<f32>§display: Option<Display>§border_style: Option<BorderStyle>

borderStyle value (styles.ts:255, 745). Some(_) → border active, layout width = 1 per enabled edge. None → no border (width = 0). Renderer uses the variant to select box-drawing characters (M1-5).

§border_top: Option<bool>

borderTop === false disables the top border edge (styles.ts:748-749).

§border_right: Option<bool>§border_bottom: Option<bool>§border_left: Option<bool>§gap: Option<f32>

All-axes shorthand (yoga GUTTER_ALL).

§column_gap: Option<f32>§row_gap: Option<f32>§text_wrap: Option<TextWrap>

textWrap mode for ink-text nodes. None → default Wrap (matches ink’s ?? 'wrap' fallback at dom.ts:242).

§overflow_x: Option<Overflow>§overflow_y: Option<Overflow>§background_color: Option<String>§border_color: Option<String>§border_top_color: Option<String>§border_right_color: Option<String>§border_bottom_color: Option<String>§border_left_color: Option<String>§border_background_color: Option<String>§border_top_background_color: Option<String>§border_right_background_color: Option<String>§border_bottom_background_color: Option<String>§border_left_background_color: Option<String>§border_dim_color: Option<bool>§border_top_dim_color: Option<bool>§border_right_dim_color: Option<bool>§border_bottom_dim_color: Option<bool>§border_left_dim_color: Option<bool>

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Style

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Style

Source§

fn default() -> Style

Returns the “default value” for a type. Read more
Source§

impl PartialEq for Style

Source§

fn eq(&self, other: &Style) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnsafeUnpin for Style

§

impl UnwindSafe for Style

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.