Skip to main content

@value

Decorator for non-control value types to enable sparse _values tracking.

Applies @dataclass (passing dataclass_kwargs) and installs Prop descriptors via _install_props. No base class is required — the decorator wraps __init__ to inject _values and _dirty before the first Prop.__set__ call, and registers the class as a Value subclass for isinstance checks.

Usage::

@value class TextStyle: color: Optional[str] = None size: Optional[float] = None

or with explicit dataclass kwargs:

@value(eq=False) class TextStyle: ...