ValyroUI Русская версия

Code Tabs

Code variants in tabs: npm, pnpm, bun, with copy. Pro · Animated components › Code and numbers

Several versions of one snippet behind tabs — install commands per package manager, TS and JS — with one copy button.

Installation

npx valyro-cli@latest login
npx valyro-cli@latest add code-tabs
npm install valyro-ui-pro

import 'valyro-ui-pro/styles.css';
import { CodeTabs } from 'valyro-ui-pro';

Props

PropTypeDefault
codes *Record<string, string>The variants in order: tab name → code (npm, pnpm, bun; TypeScript, JavaScript).
languagestring | Record<string, string>'bash'Highlighting language for every tab, or per tab name (default bash).
valuestringName of the shown tab.
defaultValuestringInitial value when uncontrolled.
onValueChange(value: string) => voidCalled with the new value when it changes.
copyablebooleantrueCopy button for the shown variant (default true).
onCopy(code: string, tab: string) => voidCalled after a successful copy with the code and its tab.
showLineNumbersbooleanfalseLine-number gutter.
animation'default' | 'spring''spring'spring (default): the indicator springs, the code slides in and the block eases to the new height.
labelsPartial<CodeTabsLabels>Overrides for the built-in English text; keys left out keep their defaults.

Related components

Previous: Share Button · Next: Number Wheel · All Animated components