button-states

Solid

Every interactive element needs a complete set of visual states — rest, hover, active/pressed, focus, disabled, and loading. States should be derived algorithmically from the base colour, not chosen arbitrarily. Use when designing buttons, links, inputs, or any clickable component.

AI & Automation 31 stars 5 forks Updated 2 days ago MIT

Install

View on GitHub

Quality Score: 85/100

Stars 20%
50
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
80
License 10%
100
Description 5%
100

Skill Content

# Button and Interactive Element States Every interactive component must have a complete, visually distinct state for each interaction mode. Missing or ambiguous states make the UI feel unfinished and reduce user confidence. ## The Six States | State | Trigger | Visual signal | |---|---|---| | **Rest** | Default | Base colour, cursor: pointer | | **Hover** | Mouse over | Slightly darker, subtle background shift | | **Active / Pressed** | Mouse down / tap | Noticeably darker, slight scale-down | | **Focus** | Keyboard navigation | Visible focus ring, no change to fill | | **Disabled** | Not available | Low contrast, cursor: not-allowed, no interaction | | **Loading** | Async action in progress | Spinner or pulse, non-interactive | ## Deriving State Colours Algorithmically State colours are not chosen independently — they are derived from the base colour by adjusting lightness in HSL. This guarantees coherence across the entire palette. ``` base: hsl(H, S%, L%) hover: hsl(H, S%, L% - 8%) ← darken 8% active: hsl(H, S%, L% - 14%) ← darken 14% ``` ### Example: primary button `#635BFF` (hsl 243, 100%, 68%) ```css .btn-primary { background: hsl(243, 100%, 68%); /* rest #635BFF */ } .btn-primary:hover { background: hsl(243, 100%, 60%); /* hover #4A40FF */ } .btn-primary:active { background: hsl(243, 100%, 54%); /* active #3429FF */ } ``` For light buttons on dark backgrounds, invert the logic — lighten on hover instead of darkening...

Details

Author
dembrandt
Repository
dembrandt/dembrandt-skills
Created
3 months ago
Last Updated
2 days ago
Language
JavaScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category