Rotate

Rotate — wraps a child and applies a 2D rotation to its entire
subtree, driven by an external Prop<f32> of radians. Layout-
stable: the wrapper reports the child's natural size at all
angles; only the visual content rotates within the slot.
Public functions
Rotate
| Returns | Function |
|---|---|
| Constructors | |
Self | new(angle: impl Into<Prop<f32>>) |
| Builder methods | |
Self | origin(origin: ScaleOrigin) |
Self | child(widget: impl teksilo_core::IntoTeksiChild) |
Self | child_opt(widget: Option<impl teksilo_core::IntoTeksiChild>) |
Detailed description
let angle = ctx.animated_signal(0.0);
ctx.add(Rotate::new(angle.clone()).child(chevron));
// Animate to 90° on expand:
angle.animate_to(std::f32::consts::FRAC_PI_2, Duration::from_millis(150), Easing::EaseOut);
No internal animation — the caller owns the angle signal and pairs
it with Signal::animate_to (or ctx.animate()) for animated
rotations. This keeps the widget composable: bind it to interaction
state for hover-on rotation, to an animated signal for spinning
loaders, to a constant for static decorative rotation.
Use cases: animated chevrons (the disclosure-state pattern, today
faked by visibility-toggling two static chevron icons), spinning
loaders not covered by Spinner, "shake your
head no" rotation feedback, dial controls.
Reduced motion
Rotate doesn't introduce motion — it just applies whatever the
caller's angle signal currently holds. Reduced-motion handling
belongs at the caller's animate_to site (use to_or_snap or
gate the animation behind prefers_reduced_motion).
Density
The picture above is the widget at TargetDensity::Compact, the mouse-and-keyboard ladder. Below is the same subject on the same canvas with only the ladder changed, so what moves is the density and nothing else — where the subject no longer fits, that is what the denser targets cost it at that size. See docs/density-and-targets.md.
Touch

API reference
📖 Full rustdoc API for this module
pub struct Rotate
Import: use teksilo::widgets::Rotate;
Wraps a child widget and rotates its entire subtree by an externally-driven angle in radians.
#![allow(unused)] fn main() { pub struct Rotate { /* fields */ } }
Methods
pub fn new(angle: impl Into<Prop<f32>>) -> Self
Create a rotate wrapper bound to angle (radians); accepts a
static f32 or a reactive Signal<f32>. Default pivot: Center.
pub fn origin(mut self, origin: ScaleOrigin) -> Self
Pivot point for the rotation. Default Center.
pub fn child(mut self, widget: impl teksilo_core::IntoTeksiChild) -> Self
Inline child widget (deferred insertion).
pub fn child_opt(self, widget: Option<impl teksilo_core::IntoTeksiChild>) -> Self
Attach widget when it is Some, and do nothing when it is None.
The conditional-child form. teksu!'s if without an else lowers to
this, and it is what cond.then(|| w) is for in a builder chain. None
adds no arena node, so nothing is laid out, painted, or published to the
accessibility tree, and a stack applies no spacing around it.