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 54 stars 9 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 87/100

Stars 20%
58
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
4 months ago
Last Updated
yesterday
Language
JavaScript
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category

AI & Automation Solid

algorithmic-color-palette

Derive a full UI colour palette algorithmically from one or two brand colours. Darker and lighter variants for interactive states, desaturated greys from the brand hue for borders and backgrounds, and semantic colours that feel coherent with the brand rather than generic. Use when building a colour system from scratch or expanding a limited brand palette for UI use.

54 Updated yesterday
dembrandt
Web & Frontend Listed

component-states

State matrix for interactive UI. Use when building or reviewing buttons, links, inputs, tabs, toggles, menus, cards, or controls that need hover, focus, active, disabled, loading, selected, error, keyboard, or ARIA states.

8 Updated 5 days ago
KyaniteLabs
Code & Development Listed

lonja-buttons

Enforces the CatchLaw action ladder, buttons as printed stamps — one primary per screen and never two, LonjaButtonVariant primary a solid harbour 1B4D5E field at radius 0, secondary an ink outline, quiet a rule-grey outline, destructive oxblood 7A2320 behind a confirmation, link only in prose, zero elevation and NoSplash.splashFactory instead of shadows, a default, hover, focus, pressed, disabled and busy matrix resolved in WidgetStateProperty, 56dp regular and 46dp compact heights glove mode floors to 66dp, 44dp IconButton carrying a real semanticLabel, a busy latch so a double tap never writes two rows, and a verb label naming exactly what happens. Use when adding a button, styling ElevatedButton, FilledButton, TextButton, IconButton or SegmentedButton, editing lib/ui/core/lonja_button.dart, wiring onPressed to a Notifier, choosing between primary and quiet, adding a destructive affordance, or reviewing any tappable in a diff.

0 Updated 1 months ago
zakariaf