Default theme for VuePress providing navigation, sidebar, search, and responsive documentation layouts
—
Globally available Vue components for content enhancement including badges, code blocks, and tabbed code groups that can be used directly in markdown files.
Inline badge/label component with color variants for highlighting important information.
/**
* Inline badge/label functional Vue component
* Available globally as <Badge>
*/
const Badge: VueComponent = {
functional: true,
props: {
/** Badge type/color variant */
type: {
type: String,
default: 'tip'
},
/** Badge text content */
text: String,
/** Vertical alignment */
vertical: {
type: String,
default: 'top'
}
},
render(h, { props, slots }): VNode
};Props:
type (String, default: 'tip'): Badge color variant (tip, error, warning, etc.)text (String): Badge text contentvertical (String, default: 'top'): Vertical alignment (top, middle, bottom)Badge Types:
tip / green: Green badge for tips and positive informationerror: Red badge for errors and critical informationwarning / warn / yellow: Yellow badge for warningsUsage Examples:
<!-- In markdown files -->
<Badge text="new" type="tip" />
<Badge text="deprecated" type="warning" />
<Badge text="beta" type="error" />
<!-- With default slot content -->
<Badge type="tip">New Feature</Badge>
<!-- With custom vertical alignment -->
<Badge text="v2.0" vertical="middle" />Tabbed code block container component for displaying multiple code examples with tab navigation.
/**
* Tabbed code block container Vue component
* Available globally as <CodeGroup>
*/
const CodeGroup: VueComponent = {
name: 'CodeGroup',
data() {
return {
codeTabs: Array,
activeCodeTabIndex: Number
};
},
slots: {
default: {} // Code blocks content
},
methods: {
changeCodeTab(index: number): void
},
mounted(): void,
beforeDestroy(): void
};Usage Examples:
<CodeGroup>
<CodeBlock title="NPM">
```bash
npm install package-nameyarn add package-nameIndividual code block component used within CodeGroup for tabbed code examples.
/**
* Individual code block Vue component for use within CodeGroup
* Available globally as <CodeBlock>
*/
const CodeBlock: VueComponent = {
name: 'CodeBlock',
props: {
/** Tab title for the code block */
title: {
type: String,
required: true
},
/** Whether this code block is active */
active: {
type: Boolean,
default: false
}
},
slots: {
default: {} // Code content
}
};Props:
title (String, required): Tab title displayed in CodeGroup navigationactive (Boolean, default: false): Whether this code block is initially activeUsage:
<CodeBlock title="JavaScript">
```javascript
const result = processData(input);
console.log(result);Global components can be nested and combined:
<!-- Badge within code group -->
<CodeGroup>
<CodeBlock title="Current API">
```javascript
// Current implementation
const api = new API();// Old implementation <Badge text="deprecated" type="warning" />
const oldApi = new OldAPI();Components inherit theme styling but can be customized:
// Custom badge styles
.badge
&.custom
background-color #ff6b6b
color white
// Custom code group styles
.theme-code-group
.theme-code-group__nav-tab
&.custom-tab
background-color #f8f8f8Global components are automatically registered by VuePress and available in all markdown files without imports:
// Automatic registration (handled by VuePress)
Vue.component('Badge', Badge);
Vue.component('CodeGroup', CodeGroup);
Vue.component('CodeBlock', CodeBlock);Global components include accessibility features:
// Accessibility features
interface AccessibilityFeatures {
/** Keyboard navigation support */
keyboardNavigation: boolean;
/** ARIA labels and roles */
ariaSupport: boolean;
/** Focus management */
focusManagement: boolean;
/** Screen reader compatibility */
screenReaderSupport: boolean;
}Global components work in all modern browsers:
Components gracefully degrade in older browsers with basic HTML/CSS fallbacks.
Install with Tessl CLI
npx tessl i tessl/npm--vuepress--theme-default