A professional component library for building beautiful documentation and showcase sites with SvelteKit.
๐ง Release Candidate: This is version 1.0.0-rc01 - a release candidate for testing and feedback. The API is stable but may have minor changes before the final 1.0.0 release.
- ๐จ Beautiful Components - Pre-styled components with Bootstrap integration
- ๐ Syntax Highlighting - Powered by highlight.js with 50+ language support
- ๐ฑ Fully Responsive - Mobile-first design that works on all devices
- ๐ Svelte 5 Ready - Built with the latest Svelte 5 features and runes
- ๐ฏ TypeScript Support - Full TypeScript support with type definitions
- ๐ง Highly Configurable - Extensive configuration system for customization
- ๐ฆ Zero Config - Works out of the box with sensible defaults
npm install @keenmate/svelte-docsYou need to import the CSS styles in your app. You have several options:
<!-- src/app.html or your main layout -->
<script>
import '@keenmate/svelte-docs/styles';
</script>/* src/app.css */
@import '@keenmate/svelte-docs/styles/main.css';/* src/app.scss */
// Override variables before import
$primary-color: #your-color;
@import '@keenmate/svelte-docs/styles/main.scss';Create a +layout.svelte file in your routes directory:
<script lang="ts">
import { ConfigProvider } from '@keenmate/svelte-docs';
import type { PartialDocsConfig } from '@keenmate/svelte-docs';
const config: PartialDocsConfig = {
site: {
title: 'My Documentation',
description: 'Documentation for my awesome project',
keywords: ['documentation', 'svelte', 'awesome']
},
company: {
name: 'My Company',
website: 'https://example.com'
},
navigation: {
main: [
{ label: 'Home', href: '/', icon: '๐ ' },
{ label: 'Docs', href: '/docs', icon: '๐' },
{ label: 'API', href: '/api', icon: '๐' }
]
}
};
</script>
<ConfigProvider configData={config}>
<slot />
</ConfigProvider><script>
import { DocLayout, ShowcaseSection, CodeShowcase } from '@keenmate/svelte-docs';
</script>
<DocLayout titleText="Getting Started">
<ShowcaseSection
titleText="Installation"
subtitleText="Get started in minutes"
>
{#snippet demoContent()}
<h4>Quick Install</h4>
<p>Install the package using npm:</p>
{/snippet}
{#snippet controlsContent()}
<button class="btn btn-primary">Copy Command</button>
{/snippet}
{#snippet descriptionContent()}
<p>This will install the latest version of the library.</p>
{/snippet}
</ShowcaseSection>
<CodeShowcase
titleText="Example Code"
svelteCodeContent={`<Button variantType="primary">Click me</Button>`}
typescriptCodeContent={`const handleClick = () => console.log('Clicked!');`}
/>
</DocLayout>Main page layout with navigation sidebar.
Props:
titleText?: string- Page titledescriptionText?: string- Page description for SEOisNavigationVisible?: boolean- Show/hide navigation (default: true)areBreadcrumbsVisible?: boolean- Show/hide breadcrumbs (default: true)
Global configuration provider for the entire app.
Props:
configData: PartialDocsConfig- Configuration objectpageTitleText?: string- Override page titlepageDescriptionText?: string- Override page descriptionpageKeywordsList?: string[]- Additional page keywordspageAuthorName?: string- Page authorpageOgImageUrl?: string- Open Graph image URL
Three-column layout for demonstrations with customizable column titles.
Props:
titleText: string- Section titlesubtitleText?: string- Section subtitledemoContent?: Snippet- Demo column contentcontrolsContent?: Snippet- Controls column contentdescriptionContent?: Snippet- Description column contentdemoColumnTitle?: string- Custom demo column title (default: "Demo")controlsColumnTitle?: string- Custom controls column title (default: "Controls")descriptionColumnTitle?: string- Custom description column title (default: "Description")
Multi-tab code viewer with syntax highlighting.
Props:
titleText?: string- Component titletabItems?: TabItem[]- Custom tabs arraysvelteCodeContent?: string- Svelte code contenttypescriptCodeContent?: string- TypeScript code contentcssCodeContent?: string- CSS code content
Simple code display with syntax highlighting and copy functionality.
Props:
codeContent: string- Code to displaylanguageType?: string- Programming languagetitleText?: string- Optional title/filenameisCopyable?: boolean- Enable copy button (default: true)
Feature cards with icons and descriptions.
Props:
iconEmoji?: string- Icon emojititleText: string- Card titledescriptionText: string- Card descriptionlinkHref?: string- Link URLlinkLabel?: string- Link textvariantType?: string- Bootstrap variantbadgeText?: string- Badge textbadgeVariantType?: string- Badge variantisDisabled?: boolean- Disabled state
The library uses a comprehensive configuration system:
interface PartialDocsConfig {
site?: {
title?: string;
description?: string;
keywords?: string[];
author?: string;
url?: string;
language?: string;
ogImage?: string;
twitterHandle?: string;
};
company?: {
name?: string;
website?: string;
logo?: string;
logoAlt?: string;
social?: {
github?: string;
twitter?: string;
linkedin?: string;
facebook?: string;
};
};
navigation?: {
main?: NavigationItem[];
social?: SocialLink[];
};
features?: {
search?: boolean;
breadcrumbs?: boolean;
tableOfContents?: boolean;
};
}This library follows explicit, self-documenting property naming conventions:
- Boolean properties use prefixes:
is*,has*,can*,should* - Text properties use suffix:
*Text - Type/variant properties use suffix:
*Type - Collection properties use specific suffixes:
*Items,*List - URL properties use suffix:
*Urlor*Href
Examples:
titleTextinstead oftitleisDisabledinstead ofdisabledvariantTypeinstead ofvarianttabItemsinstead oftabs
The library includes automatic syntax highlighting powered by highlight.js:
<CodeBlock
codeContent={yourCode}
languageType="javascript"
titleText="Example"
isCopyable={true}
/>Supports 50+ languages including:
- JavaScript, TypeScript, Svelte
- Python, Java, C++, Rust, Go
- HTML, CSS, SCSS
- JSON, YAML, Markdown
- SQL, GraphQL
- And many more...
The library includes custom styling with CSS variables that you can override.
Override these CSS custom properties to customize the theme:
:root {
--docs-primary: #00A7E1;
--docs-primary-rgb: 0, 167, 225;
--docs-secondary: #003459;
--docs-secondary-rgb: 0, 52, 89;
--docs-dark: #00171F;
--docs-light: #f8f9fa;
--docs-border: #dee2e6;
--docs-body-color: #212529;
--navbar-height: 56px;
--sidebar-width: 280px;
--footer-height: 60px;
}If you import the SCSS file, you can override these variables:
// Override before importing
$color-primary: #your-primary-color;
$color-secondary: #your-secondary-color;
$sidebar-width: 320px;
$navbar-height: 64px;
@import '@keenmate/svelte-docs/styles/main.scss';This library is optimized for SvelteKit static builds:
// svelte.config.js
import adapter from '@sveltejs/adapter-static';
export default {
kit: {
adapter: adapter({
pages: 'build',
assets: 'build',
fallback: undefined,
precompress: false,
strict: true
})
}
};// src/routes/+layout.ts
export const prerender = true;- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
# Clone repository
git clone https://github.com/keenmate/svelte-docs.git
cd svelte-docs
# Install dependencies
npm install
# Start development server
npm run dev
# Build library
npm run package
# Run checks
npm run checkContributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
MIT ยฉ KeenMate
Made with โค๏ธ by KeenMate