Logoshadcn-docs-template
DocsDemo
Sections
  • Get Started
Getting Started
  • Introduction
  • Installation
Customization
  • Customizing the Template
  • MDC Components
  • Composables
  • Writing Documentation
Components
  • DocTabs
  • Callout
  • ComponentPreview
  • CommandMenu
  • CopyButton
  • DocsSidebar
  • DocsTableOfContents
  • PageHeader
  • SiteHeader
  • CopyCodeButton
  • DocsCopyPage
  • CodeBlockCommand
  • CommandMenuItem
  • CommandMenuKbd
  • GitHubLink
  • LucideIcon
  • MainNav
  • MobileNav
  • ModeSwitcher
  • PageHeaderDescription
  • PageHeaderHeading
  • SiteBody
  • SiteConfig
  • SiteFooter
  • OgImage (Custom)

SiteConfig

PreviousNext

A button component for toggling between fixed and full-width layouts.

The SiteConfig component provides a button to toggle between fixed-width and full-width content layouts.

Usage

<script setup lang="ts">
import { SiteConfig } from '@/components/SiteConfig'
</script>

<template>
  <SiteConfig />
</template>

Features

  • Toggles between "fixed" and "full" layout modes
  • Persists preference in cookies
  • Applies layout class to document element
  • Uses GalleryHorizontalIcon for visual indicator

API Reference

SiteConfig

PropTypeDefaultDescription
classHTMLAttributes["class"]undefinedCustom CSS classes

Behavior

  • Click to toggle: fixed → full → fixed
  • Saves preference in cookie (user-config)
  • Applies layout-fixed or layout-full class to document.documentElement
  • Uses useConfig() composable for state management

Layout Classes

When toggled, applies classes to the document:

  • layout-fixed: Constrains content width
  • layout-full: Full viewport width

Customization

The layout classes can be styled in your CSS:

.layout-fixed {
  /* Fixed width styles */
}

.layout-full {
  /* Full width styles */
}
SiteBodySiteFooter

On This Page

UsageFeaturesAPI ReferenceSiteConfigBehaviorLayout ClassesCustomization
© shadcn-vue.com