jaspr-styling

Generate type-safe Jaspr CSS-in-Dart styles with @css static getters.

803|85|Updated Nov 18, 2023
One-click install
npx skills add https://github.com/rodydavis/signals.dart --skill jaspr-styling
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: jaspr-styling
Source: https://github.com/rodydavis/signals.dart/tree/main/.agents/skills/jaspr-styling
Command: npx skills add https://github.com/rodydavis/signals.dart --skill jaspr-styling

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you write correct, maintainable, type-safe styling for Jaspr components without guesswork or style leakage across the UI.

Core Features & Use Cases

  • Component-scoped CSS-in-Dart: Define styles using the @css annotation on a static getter returning List<StyleRule> to keep styling local and predictable.
  • Safe composition rules: Use explicit selectors (classes/ids) and parent selectors like css('&') to avoid unintended global impact.
  • Typed properties for layout and visuals: Apply strongly-typed Styles/.styles() properties for color, typography, sizing, flexbox, grid, and interaction/box model concerns.
  • Animations and transitions guidance: Use Transition and Animation typing, including keyframes via css.keyframes, to implement motion without stringly-typed errors.
  • When to use inline vs global styles: Use inline styles only for dynamic cases, and reserve complex rules (hover/media/animations) for @css.

Quick Start

Ask the skill to generate a component example that uses an @css static getter to style a .main container, includes a hover rule, and adds a responsive media query while following Jaspr’s rules for selectors and inline styles.

Frequently Asked Questions about jaspr-styling

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write type-safe CSS in Dart for Jaspr components?

Type-safe CSS in Dart for Jaspr components is written using static getters annotated with `@css` that return `List<StyleRule>`. This approach enforces strongly-typed properties for layout and visuals, preventing style leakage and maintaining predictable component scoping.

What is the best way to prevent style bleeding in Jaspr component styling?

To prevent style bleeding in Jaspr component styling, use explicit selectors like classes or IDs and parent selectors such as `css('&')`. Defining rules within a `@css` static getter ensures styles remain local and predictable without unintended global impact.

How do I add hover effects and media queries to Jaspr styles?

Hover effects and media queries in Jaspr styles are added inside the `@css` static getter rather than inline styles. Using typed properties allows you to define complex interaction rules, responsive breakpoints, transitions, and keyframe animations predictably.

When should I use inline styles versus global static styles in Jaspr?

Inline styles in Jaspr should be reserved exclusively for dynamic styling cases. Complex styling rules, including hover effects, media queries, transitions, and keyframe animations, must be placed in a `@css` static getter to maintain type safety and scoping.

Can I use flexbox and grid layouts with typed Styles properties in Jaspr?

Yes, you can apply strongly-typed `Styles` and `.styles()` properties for flexbox and grid layouts in Jaspr. This typed approach manages sizing, typography, colors, and box model constraints without stringly-typed errors.

How do I implement keyframe animations in Jaspr without string errors?

Keyframe animations in Jaspr are implemented using the `Animation` and `Transition` typing alongside `css.keyframes`. This method provides motion implementation for components while avoiding stringly-typed errors in your Dart styling workflow.