CSS_QUICK_REFERENCE.md

md7 kBIn exam.zip

CSS Class Quick Reference

Use this as a quick lookup while coding. All classes are defined in src/index.css


๐ŸŽจ Layout Classes

Class Purpose Example
container Main wrapper (max-width 1200px) <div className="container">
card White box with shadow <div className="card">
card-title Card heading <h2 className="card-title">
grid CSS Grid container <div className="grid">
grid-2 2-column grid <div className="grid grid-2">
grid-3 3-column grid <div className="grid grid-3">

๐Ÿ”˜ Button Classes

Class Appearance When to Use
btn Base button Always combine with color class
btn-primary Blue button Main actions (Save, Submit)
btn-secondary Gray button Secondary actions (Cancel)
btn-danger Red button Destructive actions (Delete)
btn-sm Small size Compact buttons

Examples:

JSX
<button className="btn btn-primary">Save</button>
<button className="btn btn-secondary">Cancel</button>
<button className="btn btn-primary btn-sm">Edit</button>

๐Ÿท๏ธ Badge Classes

Class Color Use For
badge Base Always combine with type
badge-workshop Blue Workshop events
badge-talk Pink Talk events
badge-available Green Available seats (>5)
badge-almost-full Yellow Almost full (1-5 seats)
badge-sold-out Red No seats left

Examples:

JSX
<span className="badge badge-workshop">๐Ÿ› ๏ธ Workshop</span>
<span className="badge badge-available">Available</span>

๐Ÿ“ Form Classes

Form Structure

Class Purpose
form-group Wrapper for each field
form-label Field label
form-error Error message text

Form Inputs

Class Element
form-input <input type="text">
form-select <select>
form-textarea <textarea>
form-checkbox Checkbox wrapper
form-radio Radio button wrapper
form-radio-group Radio group container

Error State

Add error class to inputs with errors:

JSX
<input className={`form-input ${errors.title ? 'error' : ''}`} />

Complete Example:

JSX
<div className="form-group">
  <label className="form-label">Title *</label>
  <input 
    type="text"
    className={`form-input ${errors.title ? 'error' : ''}`}
    value={formData.title}
    onChange={handleChange}
  />
  {errors.title && (
    <span className="form-error">{errors.title}</span>
  )}
</div>

๐Ÿƒ Event Card Classes

Class Purpose
event-card Card wrapper
event-card.selected Selected state (add selected class)
event-card-header Card header section
event-card-title Event title
event-card-speaker Speaker name
event-card-info Badges container
event-card-footer Footer with buttons

Example:

JSX
<div className={`event-card ${isSelected ? 'selected' : ''}`}>
  <div className="event-card-header">
    <h3 className="event-card-title">{event.title}</h3>
    <p className="event-card-speaker">๐Ÿ‘ค {event.speaker}</p>
  </div>
  <div className="event-card-info">
    {/* badges */}
  </div>
  <div className="event-card-footer">
    {/* buttons */}
  </div>
</div>

๐Ÿ“Š Statistics Classes

Class Purpose
stats-grid Grid container for stats
stat-card Individual stat card
stat-label Label text
stat-value Large number
stat-unit Unit text (%, etc.)

Example:

JSX
<div className="stats-grid">
  <div className="stat-card">
    <div className="stat-label">Total Events</div>
    <div className="stat-value">
      {totalEvents}
    </div>
  </div>
</div>

โš ๏ธ Alert Classes

Class Color/Icon Use For
alert Base Always combine with type
alert-warning Yellow/โš ๏ธ Warnings
alert-success Green/โœ“ Success messages
alert-info Blue/โ„น๏ธ Information

Example:

JSX
<div className="alert alert-warning">
  <span>โš ๏ธ</span>
  <div>
    <strong>Warning</strong>
    <p>This is a warning message</p>
  </div>
</div>

๐Ÿšซ Empty State Classes

Class Purpose
empty-state Container
empty-state-icon Large icon
empty-state-title Title text
empty-state-text Body text

Example:

JSX
<div className="empty-state">
  <div className="empty-state-icon">๐Ÿ“ญ</div>
  <h3 className="empty-state-title">No Events Found</h3>
  <p className="empty-state-text">Try adjusting your filters</p>
</div>

Class Purpose
modal-overlay Dark background overlay
modal Modal container
modal-header Modal header
modal-title Modal title
modal-body Modal content
modal-footer Modal actions

Example:

JSX
<div className="modal-overlay">
  <div className="modal">
    <div className="modal-header">
      <h2 className="modal-title">Edit Event</h2>
    </div>
    <div className="modal-body">
      {/* form content */}
    </div>
    <div className="modal-footer">
      <button className="btn btn-secondary">Cancel</button>
      <button className="btn btn-primary">Save</button>
    </div>
  </div>
</div>

๐Ÿ› ๏ธ Utility Classes

Spacing

Class Effect
mt-sm Small margin top
mt-md Medium margin top
mt-lg Large margin top
mb-sm Small margin bottom
mb-md Medium margin bottom
mb-lg Large margin bottom

Flexbox

Class Effect
flex Display flex
flex-between Space between
flex-center Center items
gap-sm Small gap
gap-md Medium gap
gap-lg Large gap

Text

Class Effect
text-center Center text

๐ŸŽฏ Common Patterns

Conditional Classes

JSX
className={`event-card ${isSelected ? 'selected' : ''}`}
className={`form-input ${hasError ? 'error' : ''}`}
className={`badge badge-${event.type}`}

Multiple Classes

JSX
className="btn btn-primary btn-sm"
className="grid grid-2"
className="alert alert-warning mt-lg"

Template Literals for Dynamic Classes

JSX
className={`badge badge-${statusType}`}
// statusType could be: 'available', 'almost-full', 'sold-out'

๐Ÿ’ก Pro Tips

  1. Copy exact class names - They're case-sensitive
  2. Combine classes with spaces - "card mt-lg"
  3. Use template literals for dynamic classes - badge-${type}
  4. Check templates - All patterns are shown in COMPONENT_TEMPLATES.md
  5. Don't modify CSS - All styling is complete

โš ๏ธ Common Mistakes

โŒ Wrong:

JSX
<div className="Card">           // Capital C
<div className="btn primary">    // Missing hyphen
<div className="form input">     // Should be form-input

โœ… Correct:

JSX
<div className="card">
<div className="btn btn-primary">
<div className="form-input">

๐Ÿ” Quick Lookup

Need a class? Find it here:

  • Container? โ†’ container
  • Button? โ†’ btn btn-primary
  • Input field? โ†’ form-input
  • Error message? โ†’ form-error
  • Badge? โ†’ badge badge-workshop
  • Card? โ†’ card
  • Alert? โ†’ alert alert-warning
  • Modal? โ†’ modal-overlay + modal

Print this page or keep it open while coding! ๐Ÿ“„

In TEMPLATES/