Skip to content

Code

Read-only command/code snippet block with a copy-to-clipboard button. Plain text only — it doesn’t do syntax highlighting, and prompt is just a display hint (no relation to any actual shell or language). The prompt character is hidden by default; opt in with showPrompt.

<and-code value="pnpm add @andersseen/web-components" show-prompt></and-code>

Properties

PropertyAttributeDescriptionTypeDefault
copyablecopyableWhether to show the copy button.booleantrue
customClassclassAdditional CSS classes from the consumer.string''
heightheightFixed height of the block (CSS length).string'auto'
promptpromptPrompt character shown before each line (e.g. $, >, #). Ignored unless showPrompt is true.string'$'
showPromptshow-promptWhether to show the prompt character before each line. Off by default — opt in per instance.booleanfalse
valuevalueCode or command to display.string''

Events

EventDescriptionType
andCodeCopyEmitted when the content is copied to the clipboard.CustomEvent<{ value: string; success: boolean; }>
Generated from packages/web-components/src/components/and-code/readme.md — keep this in sync with the Stencil source, don't hand-edit the numbers.