Getting Started
Where This Package Fits: Styles sits in the Infrastructure layer. It depends on Tokens and is used by Elements, Components, and your custom CSS. See full architecture.
About This Guide
This guide demonstrates practical implementations of the UMD Styles Library for creating consistent, accessible designs. For setup instructions, see the Static CSS Guide or Getting Started.
Common Use Cases
Use Case 1: Typography Utility Classes
The UMD Styles Library provides a complete set of typography utility classes for sans-serif, serif, and campaign font families, plus rich text helpers.
Sans-Serif Classes
| Class Name | Description |
|---|---|
umd-sans-smallest |
Smallest sans-serif text size |
umd-sans-small |
Small sans-serif text |
umd-sans-medium |
Medium (default body) sans-serif text |
umd-sans-large |
Large sans-serif text |
umd-sans-larger |
Larger sans-serif text |
umd-sans-largest |
Largest sans-serif text |
umd-sans-largest-uppercase |
Largest sans-serif text, uppercased |
Serif Classes
| Class Name | Description |
|---|---|
umd-serif-small |
Small serif text |
umd-serif-medium |
Medium serif text |
umd-serif-large |
Large serif text |
umd-serif-larger |
Larger serif text |
umd-serif-largest |
Largest serif text |
Campaign Font Classes
| Class Name | Description |
|---|---|
umd-campaign-small |
Small campaign (Barlow Condensed) text |
umd-campaign-medium |
Medium campaign text |
umd-campaign-large |
Large campaign text |
umd-campaign-larger |
Larger campaign text |
umd-campaign-largest |
Largest campaign text |
umd-campaign-largest-uppercase |
Largest campaign text, uppercased |
Rich Text Classes
| Class Name | Description |
|---|---|
umd-text-rich-simple |
Base rich text styling for body content |
umd-text-rich-simple-large |
Larger rich text styling for featured content |
umd-text-rich-simple-small |
Smaller rich text styling for compact areas |
Usage Example
<h1 class="umd-campaign-largest-uppercase">Campaign Headline</h1>
<h2 class="umd-sans-larger">Section Title</h2>
<p class="umd-serif-medium">Body text in Crimson Pro serif.</p>
<!-- Rich text block with proper spacing and sizing -->
<div class="umd-text-rich-simple">
<p>Paragraphs, lists, and links receive consistent styling.</p>
<ul>
<li>Styled list items</li>
</ul>
</div>
Use Case 2: Grid System Classes
The UMD Styles Library provides two types of grid systems: Grid with Gaps (for spacing between items) and Grid with Borders (for table-like layouts).
Available Grid Gap Classes
| Class Name | Columns | Description | Responsive Behavior |
|---|---|---|---|
umd-layout-grid-gap-two |
2 | Two-column grid with standard gaps | Stacks to 1 column on mobile |
umd-layout-grid-gap-three |
3 | Three-column grid with standard gaps | Mobile: 1 col, Tablet: 2 cols |
umd-layout-grid-gap-three-large |
3 | Three-column grid with larger gaps on desktop | Mobile: 1 col, Tablet: 2 cols, Desktop: larger gaps |
umd-layout-grid-gap-four |
4 | Four-column grid with standard gaps | Mobile: 1 col, Tablet: 2 cols |
umd-layout-grid-gap-four-centered |
4 | Four-column grid where first item spans 2 columns | Mobile: 1 col, Tablet: 2 cols |
umd-layout-grid-gap-stacked |
1 | Single column with consistent vertical spacing | Always single column |
Available Grid Border Classes
| Class Name | Columns | Description | Border Style |
|---|---|---|---|
umd-layout-grid-border-two |
2 | Two-column grid with borders | 1px solid #E0E0E0 |
umd-layout-grid-border-three |
3 | Three-column grid with borders | 1px solid #E0E0E0 |
umd-layout-grid-border-four |
4 | Four-column grid with borders | 1px solid #E0E0E0 |
Gap Values
Standard Gap: 16px (mobile), 24px (tablet), 32px (desktop)
Large Gap: 16px (mobile), 24px (tablet), 48px (desktop), 64px (high-def)
Stacked Gap: 32px vertical spacing between items
Usage Example
<!-- Standard three-column grid -->
<div class="umd-layout-grid-gap-three">
<div>Item 1</div>
<div>Item 2</div>
<div>Item 3</div>
</div>
Use Case 3: Spacing Utility Classes
The library provides comprehensive spacing utilities for both horizontal containers (max-width with padding) and vertical spacing (margin-bottom).
Horizontal Container Classes
| Class Name | Max Width | Padding | Use Case |
|---|---|---|---|
umd-layout-space-horizontal-full |
100% | 16px (mobile), 40px (tablet), 64px (desktop) | Full-width sections |
umd-layout-space-horizontal-larger |
1400px | Same as above | Wide content areas |
umd-layout-space-horizontal-large |
1200px | Same as above | Standard content width |
umd-layout-space-horizontal-normal |
1000px | Same as above | Reading width |
umd-layout-space-horizontal-small |
800px | Same as above | Narrow content/forms |
umd-layout-space-horizontal-smallest |
600px | Same as above | Very narrow content |
Vertical Spacing Classes
| Class Name | Mobile Margin | Tablet Margin | Desktop Margin | Use Case |
|---|---|---|---|---|
umd-layout-space-vertical-landing |
48px | 96px | 120px | Major landing page sections |
umd-layout-space-vertical-landing-child |
24px | 32px | 40px | Elements within landing sections |
umd-layout-space-vertical-interior |
48px | 48px | 96px | Interior page sections |
umd-layout-space-vertical-interior-child |
24px | 24px | 24px | Elements within interior sections |
umd-layout-space-vertical-headline-large |
8px | 8px | 16px | After large headlines |
umd-layout-space-vertical-headline-medium |
8px | 8px | 8px | After medium headlines |
Usage Example
<!-- Container with reading width -->
<div class="umd-layout-space-horizontal-normal">
<h1 class="umd-layout-space-vertical-headline-large">Page Title</h1>
<p>Content with optimal reading width and proper spacing.</p>
</div>
Use Case 4: Form Field Classes
The library provides a complete set of form field classes for creating accessible, consistent forms.
Available Form Classes
| Class Name | Element Type | Description | Special Features |
|---|---|---|---|
umd-field-input |
input | Base input field styling | Supports aria-invalid for validation states |
umd-field-input-date-wrapper |
div (wrapper) | Wrapper for date inputs | Custom calendar icon |
umd-field-input-time-wrapper |
div (wrapper) | Wrapper for time inputs | Custom clock icon |
umd-field-select-wrapper |
div (wrapper) | Wrapper for select dropdowns | Custom dropdown arrow |
umd-field-select |
select | Styled select dropdown | Consistent cross-browser styling |
umd-field-textarea |
textarea | Styled textarea | Auto-resize option |
umd-field-checkbox-wrapper |
div (wrapper) | Wrapper for checkbox + label | Custom checkbox styling |
umd-field-radio-wrapper |
div (wrapper) | Wrapper for radio + label | Custom radio styling |
umd-field-file-wrapper |
div (wrapper) | Wrapper for file inputs | Custom file button |
umd-field-file |
input[type="file"] | Hidden file input | Visually hidden, label styled |
umd-field-file-label |
span | Visual file button | Shows selected filename |
umd-field-set |
fieldset | Groups related form fields | Proper spacing and borders |
umd-field-set-item |
div | Individual field container | Consistent spacing between fields |
Validation States
Valid State: Add aria-invalid="false" to show green border
Invalid State: Add aria-invalid="true" to show red border
Disabled State: Add disabled attribute for disabled styling
Usage Example
<!-- Text input with validation -->
<div class="umd-field-set-item">
<label for="email">Email</label>
<input type="email" id="email" class="umd-field-input" aria-invalid="false">
</div>
<!-- Date input with wrapper -->
<div class="umd-field-input-date-wrapper">
<input type="date" class="umd-field-input-date">
</div>
Use Case 5: Automatic Web Component Styling
All UMD web components receive automatic base styling from the styles package. No additional configuration needed.
How Automatic Styling Works
| Feature | CSS Applied | Purpose |
|---|---|---|
| Hidden Until Defined | :not(:defined) { display: none; } |
Prevents flash of unstyled content |
| Block Display | :defined { display: block; } |
Standard block-level behavior |
| Container Queries | :defined { container-type: inline-size; } |
Enables responsive component design |
Components with Special Styling
| Component | Special Styling | Description |
|---|---|---|
umd-element-accordion-item |
Auto spacing: margin-top: 4px |
Consistent spacing between accordion items |
umd-element-brand-logo-animation |
Absolute positioning, z-index: 9 | Proper logo animation placement |
umd-element-card[data-display="list"] |
Auto spacing: margin-top: 16px |
Consistent list card spacing |
umd-element-navigation-sticky |
z-index: 9999 | Ensures navigation stays on top |
umd-element-scroll-top[data-layout-fixed="true"] |
Fixed positioning, responsive sizing | Scroll to top button placement |
umd-element-social-sharing[data-layout-fixed="true"] |
Fixed positioning on desktop | Social sharing sidebar |
Component List
Base Components (automatic show/hide):
- alert-page, alert-site, banner-promo
- All carousel variants (cards, image, multiple-image, people, thumbnail)
- All hero variants (brand-video, expand, logo, minimal)
- media-inline, media-gif, quote
- pathway, pathway-highlight
- person-bio, person-hero
- slider-events, slider-events-feed
Feed Components: umd-feed-events, umd-feed-news
Navigation Components: nav-item, nav-drawer, navigation-header, navigation-sticky
Layout Components: footer, breadcrumb, call-to-action, tabs, section-intro
Benefits
<!-- Just use the component - styling is automatic! -->
<umd-element-hero data-theme="dark">
<!-- Component is hidden until JavaScript loads -->
<!-- Then displays as block with container queries enabled -->
</umd-element-hero>
Best Practices
- Always load fonts first for consistent typography
- Use semantic HTML with UMD utility classes
- Choose the appropriate grid system (gaps for cards, borders for data)
- Select container widths based on content type (reading vs. full-width)
- Apply proper vertical spacing for visual hierarchy
- Use form field wrappers for enhanced styling
- Let web components inherit their default styling
- Test across different screen sizes and browsers
Performance Tips
- Load only the CSS you need using selective imports
- Use the critical CSS pattern for above-the-fold content
- Lazy load non-critical stylesheets with the async pattern
- Combine utility classes instead of custom CSS
- Use CSS custom properties for dynamic theming
For Content Managers
For visual examples and design guidance, visit designsystem.umd.edu.
Related Resources
Styles API Reference
Complete API documentation for all styles exports.
Static CSS Guide
Pre-compiled CSS files for simpler integration.
Tailwind Integration
Integrate UMD design tokens with Tailwind CSS.