---
name: Implement Table Question
description: Create D3 questions with fill-in-the-blank tables. Students complete missing values based on patterns, rates, or relationships.
---
# Implement Table Question
Use this skill when creating questions where students:
- Fill in missing table values
- Complete ratio or rate tables
- Enter values based on patterns or proportional relationships
## When to Use This Pattern
**Perfect for:**
- "Complete the table showing costs for different months"
- "Fill in the missing values for this proportional relationship"
- "Complete the rate table"
- Any table with editable cells for data entry
**Not suitable for:**
- Tables with interactive graphs → use [implement-graph-question](../implement-graph-question/SKILL.md)
- Drag-and-drop table matching → use [implement-drag-match-question](../implement-drag-match-question/SKILL.md)
- Simple numeric adjustments → use [implement-increment-controls-question](../implement-increment-controls-question/SKILL.md)
## Components Required
**Copy these from** `.claude/skills/question-types/snippets/`:
### Required
- `tables.js` → Custom D3 table patterns (most common)
- `cards/standard-card.js` → `createStandardCard()`
### Optional
- `cards/explanation-card.js` → `createExplanationCard()` - For student explanations
- `cards/video-accordion.js` → `createVideoAccordion()` - For help videos
## Quick Start
1. **Review the pattern guide**: [PATTERN.md](PATTERN.md)
2. **Study the working example**:
```bash
cat courses/IM-8th-Grade/modules/Unit-3/assignments/117-Equivalent-Ratios/questions/05/attachments/chart.js
```
## Key Implementation Decisions
1. **Custom D3 table vs HTML table** - D3 for complex styling, HTML for simplicity
2. **Which cells are editable** - Define which cells have inputs
3. **State structure** - One field per editable cell
4. **Input validation** - Numeric only? Allow decimals? Constraints?
## State Shape
```javascript
function createDefaultState() {
return {
cell1: "", // One field per editable cell
cell2: "",
cell3: "",
cell4: "",
explanation: ""
};
}
```
## Core Pattern (HTML Table - Simplest)
```javascript
function renderTable(container) {
const tableHtml = `