pub trait StyleModifiers: Modifiable {
Show 51 methods
// Provided methods
fn id(self, id: impl Into<String>) -> Self { ... }
fn class(self, name: &str) -> Self { ... }
fn toggle_class(self, name: &str, applied: impl Res<bool>) -> Self { ... }
fn checked<U: Into<bool>>(self, state: impl Res<U>) -> Self { ... }
fn focused<U: Into<bool>>(self, state: impl Res<U>) -> Self { ... }
fn focused_with_visibility<U: Into<bool>>(
self,
focus: impl Res<U> + Copy + 'static,
visibility: impl Res<U> + Copy + 'static,
) -> Self { ... }
fn read_only<U: Into<bool>>(self, state: impl Res<U>) -> Self { ... }
fn read_write<U: Into<bool>>(self, state: impl Res<U>) -> Self { ... }
fn disabled<U: Into<bool>>(self, value: impl Res<U>) -> Self { ... }
fn display<U: Into<Display>>(self, value: impl Res<U>) -> Self { ... }
fn visibility<U: Into<Visibility>>(self, value: impl Res<U>) -> Self { ... }
fn opacity<U: Into<Opacity>>(self, value: impl Res<U>) -> Self { ... }
fn z_index<U: Into<i32>>(self, value: impl Res<U>) -> Self { ... }
fn clip_path<U: Into<ClipPath>>(self, value: impl Res<U>) -> Self { ... }
fn overflow<U: Into<Overflow>>(self, value: impl Res<U>) -> Self { ... }
fn overflowx<U: Into<Overflow>>(self, value: impl Res<U>) -> Self { ... }
fn overflowy<U: Into<Overflow>>(self, value: impl Res<U>) -> Self { ... }
fn backdrop_filter<U: Into<Filter>>(self, value: impl Res<U>) -> Self { ... }
fn shadow<U: Into<Shadow>>(self, value: impl Res<U>) -> Self { ... }
fn shadows<U: Into<Vec<Shadow>>>(self, value: impl Res<U>) -> Self { ... }
fn background_gradient<U: Into<Gradient>>(self, value: impl Res<U>) -> Self { ... }
fn background_color<U: Into<Color>>(self, value: impl Res<U>) -> Self { ... }
fn background_image<'i, U: Into<BackgroundImage<'i>>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn border_width<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn border_color<U: Into<Color>>(self, value: impl Res<U>) -> Self { ... }
fn border_style<U: Into<BorderStyleKeyword>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_top_left_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_top_right_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_left_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_right_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_radius<U: Debug + Into<CornerRadius>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_top_left_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_top_right_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_left_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_right_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_shape<U: Debug + Into<Rect<CornerShape>>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_top_left_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self { ... }
fn corner_top_right_smoothing<U: Into<f32>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_left_smoothing<U: Into<f32>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_bottom_right_smoothing<U: Into<f32>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn corner_smoothing<U: Debug + Into<Rect<f32>>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn outline_width<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn outline_color<U: Into<Color>>(self, value: impl Res<U>) -> Self { ... }
fn outline_offset<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self { ... }
fn cursor<U: Into<CursorIcon>>(self, value: impl Res<U>) -> Self { ... }
fn pointer_events<U: Into<PointerEvents>>(self, value: impl Res<U>) -> Self { ... }
fn transform<U: Into<Vec<Transform>>>(self, value: impl Res<U>) -> Self { ... }
fn transform_origin<U: Into<Position>>(self, value: impl Res<U>) -> Self { ... }
fn translate<U: Into<Translate>>(self, value: impl Res<U>) -> Self { ... }
fn rotate<U: Into<Angle>>(self, value: impl Res<U>) -> Self { ... }
fn scale<U: Into<Scale>>(self, value: impl Res<U>) -> Self { ... }
}
Expand description
Modifiers for changing the style properties of a view.
Provided Methods§
Sourcefn id(self, id: impl Into<String>) -> Self
fn id(self, id: impl Into<String>) -> Self
Sets the ID name of the view.
A view can have only one ID name and it must be unique. The ID name can be referenced by a CSS selector.
§Example
Element::new(cx).id("foo");
css
#foo {
background-color: red;
}
Sourcefn class(self, name: &str) -> Self
fn class(self, name: &str) -> Self
Adds a class name to the view.
A view can have multiple classes. The class name can be referenced by a CSS selector.
§Example
Element::new(cx).class("foo");
css
.foo {
background-color: red;
}
Sourcefn toggle_class(self, name: &str, applied: impl Res<bool>) -> Self
fn toggle_class(self, name: &str, applied: impl Res<bool>) -> Self
Sets whether a view should have the given class name.
Sourcefn checked<U: Into<bool>>(self, state: impl Res<U>) -> Self
fn checked<U: Into<bool>>(self, state: impl Res<U>) -> Self
Sets the checked state of the view.
Sourcefn focused<U: Into<bool>>(self, state: impl Res<U>) -> Self
fn focused<U: Into<bool>>(self, state: impl Res<U>) -> Self
Sets the focused state of the view.
Since only one view can have keyboard focus at a time, subsequent calls to this function on other views will cause those views to gain focus and this view to lose it.
Sourcefn focused_with_visibility<U: Into<bool>>(
self,
focus: impl Res<U> + Copy + 'static,
visibility: impl Res<U> + Copy + 'static,
) -> Self
fn focused_with_visibility<U: Into<bool>>( self, focus: impl Res<U> + Copy + 'static, visibility: impl Res<U> + Copy + 'static, ) -> Self
Sets the focused state of the view as well as the focus visibility.
Sourcefn read_only<U: Into<bool>>(self, state: impl Res<U>) -> Self
fn read_only<U: Into<bool>>(self, state: impl Res<U>) -> Self
Sets whether the view should be in a read-only state.
Sourcefn read_write<U: Into<bool>>(self, state: impl Res<U>) -> Self
fn read_write<U: Into<bool>>(self, state: impl Res<U>) -> Self
Sets whether the view should be in a read-write state.
Sourcefn disabled<U: Into<bool>>(self, value: impl Res<U>) -> Self
fn disabled<U: Into<bool>>(self, value: impl Res<U>) -> Self
Sets the view to be disabled.
This property is inherited by the descendants of the view.
Sourcefn display<U: Into<Display>>(self, value: impl Res<U>) -> Self
fn display<U: Into<Display>>(self, value: impl Res<U>) -> Self
Sets whether the view should be positioned and rendered.
A display value of Display::None
causes the view to be ignored by both layout and rendering.
Sourcefn visibility<U: Into<Visibility>>(self, value: impl Res<U>) -> Self
fn visibility<U: Into<Visibility>>(self, value: impl Res<U>) -> Self
Sets whether the view should be rendered.
The layout system will still compute the size and position of an invisible (hidden) view.
Sourcefn opacity<U: Into<Opacity>>(self, value: impl Res<U>) -> Self
fn opacity<U: Into<Opacity>>(self, value: impl Res<U>) -> Self
Sets the opacity of the view.
Exects a value between 0.0 (transparent) and 1.0 (opaque).
Sourcefn z_index<U: Into<i32>>(self, value: impl Res<U>) -> Self
fn z_index<U: Into<i32>>(self, value: impl Res<U>) -> Self
Sets the z-index of the view.
Views with a higher z-index will be rendered on top of those with a lower z-order. Views with the same z-index are rendered in tree order.
Sourcefn clip_path<U: Into<ClipPath>>(self, value: impl Res<U>) -> Self
fn clip_path<U: Into<ClipPath>>(self, value: impl Res<U>) -> Self
Sets the clip path for the the view.
Sourcefn overflow<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
fn overflow<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
Sets the overflow behavior of the view in the horizontal and vertical directions simultaneously.
Sourcefn overflowx<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
fn overflowx<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
Sets the overflow behavior of the view in the horizontal direction.
The overflow behavior determines whether child views can render outside the bounds of their parent.
Sourcefn overflowy<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
fn overflowy<U: Into<Overflow>>(self, value: impl Res<U>) -> Self
Sets the overflow behavior of the view in the vertical direction.
The overflow behavior determines whether child views can render outside the bounds of their parent.
Sourcefn backdrop_filter<U: Into<Filter>>(self, value: impl Res<U>) -> Self
fn backdrop_filter<U: Into<Filter>>(self, value: impl Res<U>) -> Self
Sets the backdrop filter for the view.
Sourcefn shadows<U: Into<Vec<Shadow>>>(self, value: impl Res<U>) -> Self
fn shadows<U: Into<Vec<Shadow>>>(self, value: impl Res<U>) -> Self
Set the shadows of the view.
Sourcefn background_gradient<U: Into<Gradient>>(self, value: impl Res<U>) -> Self
fn background_gradient<U: Into<Gradient>>(self, value: impl Res<U>) -> Self
Set the background gradient of the view.
Sourcefn background_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
fn background_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
Sets the background color of the view.
Sourcefn background_image<'i, U: Into<BackgroundImage<'i>>>(
self,
value: impl Res<U>,
) -> Self
fn background_image<'i, U: Into<BackgroundImage<'i>>>( self, value: impl Res<U>, ) -> Self
Set the background image of the view.
fn border_width<U: Into<LengthOrPercentage>>(self, value: impl Res<U>) -> Self
Sourcefn border_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
fn border_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
Sets the border color of the view.
Sourcefn border_style<U: Into<BorderStyleKeyword>>(self, value: impl Res<U>) -> Self
fn border_style<U: Into<BorderStyleKeyword>>(self, value: impl Res<U>) -> Self
Sets the border color of the view.
Sourcefn corner_top_left_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self
fn corner_top_left_radius<U: Into<LengthOrPercentage>>( self, value: impl Res<U>, ) -> Self
Sets the corner radius for the top-left corner of the view.
Sourcefn corner_top_right_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self
fn corner_top_right_radius<U: Into<LengthOrPercentage>>( self, value: impl Res<U>, ) -> Self
Sets the corner radius for the top-right corner of the view.
Sourcefn corner_bottom_left_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self
fn corner_bottom_left_radius<U: Into<LengthOrPercentage>>( self, value: impl Res<U>, ) -> Self
Sets the corner radius for the bottom-left corner of the view.
Sourcefn corner_bottom_right_radius<U: Into<LengthOrPercentage>>(
self,
value: impl Res<U>,
) -> Self
fn corner_bottom_right_radius<U: Into<LengthOrPercentage>>( self, value: impl Res<U>, ) -> Self
Sets the corner radius for the bottom-right corner of the view.
Sourcefn corner_radius<U: Debug + Into<CornerRadius>>(
self,
value: impl Res<U>,
) -> Self
fn corner_radius<U: Debug + Into<CornerRadius>>( self, value: impl Res<U>, ) -> Self
Sets the corner radius for all four corners of the view.
Sourcefn corner_top_left_shape<U: Into<CornerShape>>(self, value: impl Res<U>) -> Self
fn corner_top_left_shape<U: Into<CornerShape>>(self, value: impl Res<U>) -> Self
Sets the corner corner shape for the top-left corner of the view.
Sourcefn corner_top_right_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self
fn corner_top_right_shape<U: Into<CornerShape>>( self, value: impl Res<U>, ) -> Self
Sets the corner corner shape for the top-right corner of the view.
Sourcefn corner_bottom_left_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self
fn corner_bottom_left_shape<U: Into<CornerShape>>( self, value: impl Res<U>, ) -> Self
Sets the corner corner shape for the bottom-left corner of the view.
Sourcefn corner_bottom_right_shape<U: Into<CornerShape>>(
self,
value: impl Res<U>,
) -> Self
fn corner_bottom_right_shape<U: Into<CornerShape>>( self, value: impl Res<U>, ) -> Self
Sets the corner corner shape for the bottom-right corner of the view.
Sourcefn corner_shape<U: Debug + Into<Rect<CornerShape>>>(
self,
value: impl Res<U>,
) -> Self
fn corner_shape<U: Debug + Into<Rect<CornerShape>>>( self, value: impl Res<U>, ) -> Self
Sets the corner shape for all four corners of the view.
Sourcefn corner_top_left_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
fn corner_top_left_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
Sets the corner smoothing for the top-left corner of the view.
Sourcefn corner_top_right_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
fn corner_top_right_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
Sets the corner smoothing for the top-right corner of the view.
Sourcefn corner_bottom_left_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
fn corner_bottom_left_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
Sets the corner smoothing for the bottom-left corner of the view.
Sourcefn corner_bottom_right_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
fn corner_bottom_right_smoothing<U: Into<f32>>(self, value: impl Res<U>) -> Self
Sets the corner smoothing for the bottom-right corner of the view.
Sourcefn corner_smoothing<U: Debug + Into<Rect<f32>>>(
self,
value: impl Res<U>,
) -> Self
fn corner_smoothing<U: Debug + Into<Rect<f32>>>( self, value: impl Res<U>, ) -> Self
Sets the corner smoothing for all four corners of the view.
Sourcefn outline_width<U: Into<LengthOrPercentage>>(self, value: impl Res<U>) -> Self
fn outline_width<U: Into<LengthOrPercentage>>(self, value: impl Res<U>) -> Self
Sets the outline width of the view.
Sourcefn outline_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
fn outline_color<U: Into<Color>>(self, value: impl Res<U>) -> Self
Sets the outline color of the view.
Sourcefn outline_offset<U: Into<LengthOrPercentage>>(self, value: impl Res<U>) -> Self
fn outline_offset<U: Into<LengthOrPercentage>>(self, value: impl Res<U>) -> Self
Sets the outline offset of the view.
Sourcefn cursor<U: Into<CursorIcon>>(self, value: impl Res<U>) -> Self
fn cursor<U: Into<CursorIcon>>(self, value: impl Res<U>) -> Self
Sets the mouse cursor used when the view is hovered.
Sourcefn pointer_events<U: Into<PointerEvents>>(self, value: impl Res<U>) -> Self
fn pointer_events<U: Into<PointerEvents>>(self, value: impl Res<U>) -> Self
Sets whether the view can be become the target of pointer events.
Sourcefn transform<U: Into<Vec<Transform>>>(self, value: impl Res<U>) -> Self
fn transform<U: Into<Vec<Transform>>>(self, value: impl Res<U>) -> Self
Sets the transform of the view with a list of transform functions.
Sourcefn transform_origin<U: Into<Position>>(self, value: impl Res<U>) -> Self
fn transform_origin<U: Into<Position>>(self, value: impl Res<U>) -> Self
Sets the transform origin of the the view.
Sourcefn translate<U: Into<Translate>>(self, value: impl Res<U>) -> Self
fn translate<U: Into<Translate>>(self, value: impl Res<U>) -> Self
Sets the translation offset of the view.
Translation applies to the rendered view and does not affect layout.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.