State
Allow an element to alter its behavior when its internal state changes, using pseudo-classes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: State
ARCANUM SCHOOL: Transmutation // Conditional Metamorphosis
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
/* Different states of a physical ward */
.ward-gate {
border: 2px solid #555;
transition: all 0.2s;
}
.ward-gate:hover {
border-color: #fff;
box-shadow: 0 0 8px #fff;
}
.ward-gate:focus-within {
outline: 2px solid cyan;
background: rgba(0, 255, 255, 0.05);
}
.ward-gate:disabled,
.ward-gate[aria-disabled="true"] {
opacity: 0.5;
cursor: not-allowed;
filter: grayscale(100%);
}
The State pattern translates to CSS pseudo-classes and ARIA attribute selectors. Based purely on user interaction or scripted attribute shifts, the visual output transforms completely.
Runic Tags:
#css
#states
#accessibility
#design-patterns