UI/CSS design patterns reference for RAPID frontend - color semantics, component selection, common layouts
Quick reference for maintaining visual consistency across the RAPID frontend.
| Action Type | Button Variant | Outline | Examples |
|---|---|---|---|
| Submit/Create | primary |
false |
"Create", "Save", "Compare" |
| Cancel/Back | primary |
true |
"Cancel", "Back" |
| Delete/Remove | danger |
false (strong) / true (soft) |
"Delete Checklist" / inline delete |
| Alternative | secondary |
false |
"Duplicate", "Retry" |
| UI Toggle | text |
n/a | "Show More", "Expand Tree" |
| Inline Action | text + size="sm" |
n/a | Edit/Delete in tree nodes |
| Table Action | varies | true |
"View", "Download" |
Key Pattern: Outlined primary = cancel/dismiss. Filled primary = submit/create.
Color Mappings:
aws-sea-blue-light / aws-sea-blue-darkaws-aquaaws-lab (brand green), green-500 (icons), green-100/800 (badges)red (buttons), red-500 (icons), red-100/800 (badges)yellow-400 (borders), yellow-100/800 (badges)aws-font-color-blue (links), blue-100/800 (badges)grep -r "variant=" frontend/src/features/{similar-feature}/Anti-Patterns:
Toasts: Success -> "success", Error -> "error"
Status Badges: PENDING=Yellow, PROCESSING=Blue, DETECTING=Purple, COMPLETED=Green, FAILED=Red
Review Results: UNDER_REVIEW=Blue, PASS=Green, NOT_PASS=Red, LOW_CONFIDENCE=Yellow, USER_OVERRIDE=AWS Blue
gap-2, gap-4, p-4, p-6)max-w-7xl mx-auto px-4 py-8text-3xl font-bold, Sections: text-xl/text-2xl, Body: text-sm/text-basebg-white dark:bg-aws-squid-ink-dark, text-aws-font-color-light dark:text-aws-font-color-darkRule: Actions near their context, not right-aligned from unrelated labels.
{/* Vertical: Label -> Content -> Action */}
<div>
<span className="text-sm font-medium mb-3 block">{t("filter.label")}</span>
<div className="flex flex-wrap gap-2">{items}</div>
<div className="mt-3">
<Button variant="text" size="sm" onClick={handleClear}>{t("filter.clear")}</Button>
</div>
</div>
Critical: cursor-pointer alone is NOT enough. Elements must LOOK interactive before hovering.
{/* Use the shared Button (never a native <button>); it accepts className
for affordance styling on top of the variant. */}
<Button
variant="text"
size="sm"
className="
border-2 transition-all
border-light-gray dark:border-aws-ui-color-dark
hover:border-aws-sea-blue-light dark:hover:border-aws-sea-blue-dark
bg-aws-paper-light dark:bg-aws-paper-dark
">
Interactive Tag
</Button>
<div className={`transition-all duration-300 ${
isVisible ? 'opacity-100 max-h-10' : 'opacity-0 max-h-0 pointer-events-none'
}`}>
src/components/ before creating new components<button> -> use Button componentalert()/confirm() -> use useAlert hookreact-icons (SVG prohibited)| Use Case | Component | Key Props |
|---|---|---|
| Actions | Button |
variant outline size |
| Text input | FormTextField |
label error required |
| Textarea | FormTextArea |
label rows |
| File upload | FormFileUpload |
onFilesSelected accept |
| Modals | Modal |
isOpen onClose title |
| Confirmations | useAlert hook |
showAlert showConfirm |
| Page header | PageHeader |
title description actions |
| Data tables | Table |
columns data loading |
| Status badges | StatusBadge |
status |
| Loading | Skeleton |
count height |
| Pagination | Pagination |
currentPage totalPages |
| Errors | ErrorAlert |
error title |
| Info | InfoAlert |
message variant |
| Breadcrumbs | Breadcrumb |
items |
| Segmented control | SegmentedControl |
options value onChange |
| Tooltips | Tooltip |
content position |
For common layout implementations (page layout, grids, forms, modals, toasts), see references/LAYOUT-PATTERNS.md.