UxCodeBlock

components/ux/CodeBlock.vue

Code block with copy button, optional labeled header, collapse toggle, and dark/light themes.

Vue
import { QMap } from '@qpoint-io/qmap'
Scenarios
nuxt.config.ts
export default defineNuxtConfig({
  extends: ['@qpoint-io/q-nuxt-layer'],
})
npm install @qpoint-io/q-nuxt-layer
const aVeryLongSingleLineThatShouldScrollHorizontallyInsteadOfWrapping = useSomething({ retries: 3, timeoutMs: 30000, backoff: 'exponential' })
components/ux/CodeBlock.vue

Usage

<UxCodeBlock code = "—" label = "—" :collapsible = "false" :defaultOpen = "false" theme = "dark" />

Props

PropTypeDefaultDescription
codeStringThe code to display and copy (required)
labelString''Header label; header renders only when set or collapsible
collapsibleBooleanfalseHeader toggles the block open/closed
defaultOpenBooleanfalseInitial open state when collapsible
themeString'dark'dark (grey-900) or light (grey-50)

Related

Qpoint Brand Style Guide