Expand description
Rustyle - Pure Rust CSS-in-RS solution for Leptos 0.8.14
Rustyle provides compile-time CSS processing with zero runtime overhead, automatic scoped styles, and full SSR/CSR support for Leptos applications.
§Example
use leptos::*;
use rustyle_css::style;
#[component]
fn Button(cx: Scope) -> impl IntoView {
let class = style! {
.button {
background-color: blue;
color: white;
padding: 10px 20px;
border-radius: 5px;
}
};
view! { cx,
<button class=class>"Click Me"</button>
}
}Re-exports§
pub use tokens::validation::TokenInheritance;pub use tokens::validation::TokenRuntime;pub use tokens::validation::TokenValidator;pub use tokens::validation::ValidationResult;pub use theme::apply_theme;pub use theme::apply_theme_with_transition;pub use theme::register_system_theme;pub use theme::system_theme_detection;pub use theme::Theme;pub use theme::ThemeManager;pub use style::register_global_style;pub use style::register_style;pub use style::Style;pub use css::at_rules::CustomMediaRule;pub use css::at_rules::FontFaceRule;pub use css::at_rules::LayerRule;pub use css::at_rules::SupportsRule;pub use css::StyleBuilder;pub use css::Color;pub use css::FontSize;pub use css::FontWeight;pub use css::Length;pub use css::Radius;pub use css::Spacing;pub use tokens::DesignTokens;pub use tokens::AnimationTokens;pub use tokens::BorderTokens;pub use tokens::ColorTokens;pub use tokens::ShadowTokens;pub use tokens::SpacingTokens;pub use tokens::TypographyTokens;pub use view_transitions::register_view_transition;pub use view_transitions::ViewTransition;pub use view_transitions::ViewTransitionName;pub use components::AlertStyle;pub use components::BadgeStyle;pub use components::ButtonStyle;pub use components::CardStyle;pub use components::ComponentStyle;pub use components::DropdownStyle;pub use components::InputStyle;pub use components::ModalStyle;pub use components::PaginationStyle;pub use components::ProgressStyle;pub use components::SelectStyle;pub use components::Size;pub use components::SpinnerStyle;pub use components::State;pub use components::TableStyle;pub use components::TabsStyle;pub use components::TextareaStyle;pub use components::TooltipPosition;pub use components::TooltipStyle;pub use components::Variant;pub use optimization::extract_critical_css;pub use optimization::minify_css;pub use optimization::remove_unused_css;pub use a11y::contrast::contrast_ratio;pub use a11y::contrast::meets_wcag_aa;pub use a11y::contrast::meets_wcag_aaa;pub use a11y::reduced_motion_css;pub use a11y::register_focus_styles;pub use a11y::register_reduced_motion;pub use a11y::FocusStyle;pub use animation::AnimationState;pub use animation::AnimationStateMachine;pub use composition::MixinRegistry;pub use composition::StyleComposition;pub use composition::StyleMixin;pub use dynamic::DynamicStyleBuilder;pub use errors::create_error_message;pub use errors::suggest_property;pub use errors::RustyleError;pub use testing::CssAssertions;pub use testing::StyleValidator;pub use lint::ContrastLinter;pub use lint::CssLinter;pub use lint::LintResult;pub use lint::LintSeverity;pub use modules::CssModule;pub use modules::CssModuleClasses;pub use modules::CssModuleLoader;
Modules§
- a11y
- Accessibility utilities
- animation
- Animation state management
- components
- Component style system
- composition
- Style composition system
- css
- Type-safe CSS properties and utilities
- dynamic
- Dynamic style generation
- errors
- Error types and utilities for Rustyle
- lint
- CSS linting utilities
- modules
- CSS Modules support
- optimization
- Performance optimization utilities
- parser
- reactive
- Reactive styling support for Rustyle
- responsive
- Responsive design utilities
- scope
- ssr
- style
- testing
- Testing utilities for Rustyle
- theme
- Theme system for Rustyle
- tokens
- Design token system for Rustyle
- utils
- Common utility functions and patterns
- view_
transitions - View Transitions API support
Macros§
- container_
style - Container query style macro
- global_
style - Global style macro for un-scoped styles
- keyframes
- Keyframes macro for @keyframes animations
- layer_
style - Layer style macro for @layer
- media_
style - Media query style macro
- style
- Main style macro for compile-time CSS processing
- style_
signal - Reactive style macro that supports Leptos signals in CSS values
- style_
with_ vars - Style macro with CSS variables support
Functions§
- init
- Initialize Rustyle (call this in your app setup)