Skip to content
Search
Search the documentation
Columns
GitHub
1 min read

Columns

Set content side by side in two or three columns that stack on phones.

Columns sets content side by side: two columns, or three, each the same width. Below Tailwind’s sm breakpoint (yours, if you change it) they stack into one, so a phone reads them in order. For a grid of links, use CardGrid instead.

Before

The reader opens three pages to learn which flags the command takes, then guesses at the order.

After

One page lists every flag in the order the command reads them, with a working example under each.

Usage

Each child of Columns is one column. Wrap markdown in a <div>, with blank lines inside it so mdsvex reads the markdown, to keep several paragraphs in one column. Keep headings outside Columns: a heading belongs to the page’s outline, and a column holds part of one section.

			<script>
	import { Columns } from 'svelte-docsmith';
</script>

<Columns>
<div>

**Before**

The reader opens three pages to learn which flags the command takes.

</div>
<div>

**After**

One page lists every flag, with a working example under each.

</div>
</Columns>
		

Pass cols={3} for three columns:

Write the page in markdown.

Preview it with live examples.

Ship it as part of the app.

A component works as a column on its own, with no <div> around it. The Do and Don’t panels are made to sit in two columns.

API reference

Columns
cols 23 default 2
How many columns to lay out, from the small breakpoint up.
children required Snippet
The columns, one per child element. Wrap markdown in a <div> to keep several paragraphs in one column.

Was this page helpful?