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)

CopyCodeButton

PreviousNext

A button component for copying code with drawer and dialog variants for different screen sizes.

The CopyCodeButton component provides a responsive way to copy code, showing a drawer on mobile and a dialog on desktop.

Usage

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

<template>
  <CopyCodeButton />
</template>

Features

  • Responsive: Drawer on mobile, dialog on desktop
  • Theme-aware: Displays current theme configuration
  • Customizable: Supports different button sizes

API Reference

CopyCodeButton

PropTypeDefaultDescription
classHTMLAttributes["class"]undefinedCustom CSS classes
sizeButtonVariants["size"]undefinedButton size variant

Behavior

  • Mobile: Opens a drawer from the bottom
  • Desktop: Opens a dialog modal
  • Shows theme customization code
  • Uses useConfig() to get current theme settings
SiteHeaderDocsCopyPage

On This Page

UsageFeaturesAPI ReferenceCopyCodeButtonBehavior
© shadcn-vue.com