Skip to main content
US Army Corps of EngineersInstitute for Water Resources, Risk Management Center

Component Hierarchy

Components are organized into three tiers based on reusability and abstraction level.

For the full frontend architecture (five-layer data flow, controller hooks, etc.), see the Frontend Architecture guide.

Location: components/common/ui/

Atomic UI elements with no business logic. Shared across everything.

Inputs

ComponentPurposeKey Props
InputNumberNumeric input with scientific notation, min/max validationvalue, onValueChange, format, decimals, variant, min, max
InputTextText input with pattern validation and status warningsvalue, onValueChange, variant, pattern, warnWhen
InputTextAreaMulti-line text with optional character countervalue, onValueChange, rows, maxLength, showCounter
SelectDropdown with option normalizationvalue, onChange, options, variant, fullWidth
TextInputBare text input (no wrapper) — basic HTML input stylingvariant, type
CheckboxNative checkbox with size variantschecked, onChange, size (sm/md/lg)

Actions & Overlays

ComponentPurposeKey Props
ButtonClickable actions with variant support and optional link behaviorvariant (default/bare), disabled, to (converts to Link)
ModalFull-screen overlay dialog with header, footer, and close buttonisOpen, title, onClose, onSave, showFooter

Popovers

All popovers share the same props: title, children, placement (left/center/right), width, offset, id.

ComponentTriggerUsage
InfoPopover"?" button (steel blue)Contextual help alongside labels and checkboxes
NotesPopover"!" button (red)Notes and warnings about a field or section
DemoPopover"Demo" toggle buttonDemo/placeholder content indicators
FeaturePopover"!" button (purple)Feature request information

Display

ComponentPurposeKey Props
BubbleRounded display bubble with inset shading — used for gradation classification resultsvalue, size (sm/md/lg), variant (neutral/meets/fails/etc.)

Input Variants

All input primitives (InputNumber, InputText, Select) share a consistent size variant system:

VariantHeightUsage
default36pxStandard form fields
compact32pxInline fields, tight spaces
condensed32pxVery tight spaces, minimal padding
xs28pxSmallest (badges, mini forms)
table40pxInside table cells
tablePlainTransparent, borderless table editing
noneCustom styling only

Extraction Rule of Thumb

If a component's JSX exceeds ~80–100 lines, or if you're using {/* Section */} comments to demarcate regions, those regions should be extracted to their own components.


Visual Constants Pattern

Every component with visual styling declares named constants at the top of the file:

// ─── Visual constants ────────────────────────────────────────────
const ACCENT_BAR = 'w-16 h-1 rounded-sm bg-dst-steel mb-2';
const HEADING = 'text-xl font-bold text-slate-900';
const HINT = 'text-base font-normal text-dst-text-tertiary';
const LABEL = 'text-sm font-medium text-slate-700';

Rules:

  • Name constants by purpose, not color: TAB_ACTIVE, not BLUE_BG_WHITE_TEXT
  • Use Tailwind built-in names for neutrals: text-slate-400, bg-white
  • Use dst- tokens for brand colors: bg-dst-steel, text-dst-steel-dark
  • If multiple components in a feature share styling, extract to shared/styles.js

For naming convention details, see Case Conventions by Language.