Docs, examples


Install
npx shadcn add @klarhimmel/docs-examplesDetailsAbout, usage, props and more
Named example groups (Variants, Sizes, States, With icon, Composition), each a stage (live demo or image) with optional code beneath.
Import
Import
- docs/examples
- Category
- Documentation sections: headers, install panels, props tables, previews. New project? Set it up once: /get-started/installation.
Notes
When to use it
Stacks named example groups such as Variants, Sizes and States, each a stage with its code underneath. Use docs-preview-frame when there is only one example and a Preview and Code switch is enough.
Writing for it
- Group titles hold 40 characters and render as h3 under the block heading, so name the single thing that changes, like Sizes or With icon. - Code is allowed up to 2400 characters per group, which fits a whole demo including its imports. Leave it empty for groups where the picture says it all. - Order the groups from the default case to the edge cases, and use the group description (200 characters) to say when to choose that variant.
Watch out for
A group without code gets no code panel at all when published, so the stage sits alone in its frame. Between 1 and 8 groups are allowed, and a long page of them is better split into two blocks.
Pairs well with
Usage
The block in a page, with its default content (long lists shortened). Every prop is in the table below.
Props
The type, default and text limit of every prop. On a real page, over-limit text is kept and checkSections flags it (Installation, Check a page before you ship); this live preview shows the default until it fits. The panel above edits all props.
| Prop | Type | Default | Description |
|---|---|---|---|
title | string | 'Name the set' | Text, up to 60 characters. |
description | string | 'Say what each group changes, in one…' | Text, up to 200 characters. |
groups | { title, description, preview, demo, code }[] | 3 items | List of 1 to 8. Each item: title, description, preview (optional), demo (optional), code. |
headingLevel | '1' | '2' | - | One of '1', '2'. Optional; empty is not rendered. |