Designing Dynamic Column Components
From Placeholders To Real Columns
In our previous lesson, we built the foundation of our Kanban board with placeholder divs representing columns. Now we'll transform those static placeholders into dynamic, reusable components. Remember how we created three simple divs labeled "To Do," "In Progress," and "Done"? Those served us well for establishing the layout, but now we need proper Column components that can:
- Accept dynamic titles through props
- Render child content (which will be tasks in our next lesson)
- Maintain the responsive behavior we already implemented
The key difference between our old placeholders and the new components will be their flexibility. Instead of hardcoded text, we'll use Svelte's prop system to make the titles dynamic, and we'll implement proper child content rendering with @render.
Building The Column Component
Let's create a new file called Column.svelte in our components directory. Here's the complete implementation we're working toward:
The $props() function is how we declare component properties in Svelte 5. In this case, we're destructuring two props: title for the column header and children for the content that will be passed between the component's tags. The @render directive is Svelte 5's way of rendering child content — the ?.() syntax safely handles cases where no children exist.
For styling, we'll enhance our previous placeholder styles while maintaining the same responsive behavior:
Notice we've kept the same width, shadows, and media query from our placeholders, but added better internal structure with proper heading semantics and a flexible task area that will grow to fill available space.
Upgrading The Board
