Public API
twill keeps its public API centered on style primitives and backend adapters.
Core entry points
Styletwill::prelude::*MergeComputeValueResponsive
Tokens
Main token families:
Color,ColorFamily,Scale,ColorValueSemanticColor,SemanticThemeVars,DynamicSemanticThemeThemeVariantSpacing,Percentage,Container,BreakpointFontFamily,FontSize,FontWeight,LetterSpacing,LineHeightBorderRadius,BorderWidth,BorderStyle,OutlineStyle,RingWidthShadow,InsetShadow,DropShadow,TextShadowAnimationToken,TransitionDuration,TransitionProperty,Easing
Utilities
Common utility-style value types:
Padding,PaddingValue,PaddingVarMargin,MarginValue,MarginVarWidth,WidthVarHeight,HeightVarSizeConstraintsDisplay,Position,Overflow,ZIndexFlexContainer,FlexDirection,FlexGridContainer,GridTemplate
Recommended usage
#![allow(unused)]
fn main() {
use twill::prelude::*;
let card = Style::new()
.padding(Padding::all(Spacing::S4))
.bg(Color::slate(Scale::S50))
.rounded(BorderRadius::Lg)
.hover(|style| style.shadow(Shadow::Md))
.lg(|style| style.padding(Padding::all(Spacing::S6)));
assert!(!card.is_empty());
}
Backend surface
Feature-gated backend modules:
twill::eguitwill::icedtwill::slint
These modules convert Twill values into framework-specific primitives. Twill itself does not define components like Button or Card.
Backend-specific helper types:
twill::backends::ShadowColortwill::iced::TextDirectiontwill::slint::SlintCursor