Copy an exact command
pnpm add @noorddev/vlak-reactPresents a compact selectable command with a decorative prefix and exact-value copy action.
pnpm add @noorddev/vlak-reactpnpm add @noorddev/vlak-reactnpm install @noorddev/vlak-react
Load the stylesheet once at your app root, then import the components you use.
import "@noorddev/vlak-react/css";
import { Snippet } from "@noorddev/vlak-react";Per-component imports are available at @noorddev/vlak-react/components/snippet.
npx @noorddev/vlak-cli add snippet
Adds the component and its dependencies to components/vlak/. Follow the StyleX setup to compile the source in your application.
npx shadcn add https://vlak.dev/r/snippet.json
Installs the same source through the shadcn CLI.
import { Snippet } from "@noorddev/vlak-react";
<Snippet code="pnpm add @noorddev/vlak-react" prefix="$" label="Install command" />See the integration example to compose these components with your application's model and data.
A compact, selectable command or code line; the decorative prefix is not copied.
| Prop | Type | Default | Description |
|---|---|---|---|
coderequired | string | ||
prefix | ReactNode | ||
label | string | "Code snippet" | |
copyLabel | string | ||
copyable | boolean | true | |
onCopy | (value: string) => void | Promise<void> |
Also accepts Omit<HTMLAttributes<HTMLElement>, "onCopy" | "prefix">.
The ref reaches HTMLElement.
Exact-value clipboard action shared by compact developer views.
| Prop | Type | Default | Description |
|---|---|---|---|
valuerequired | string | ||
label | string | "Copy snippet" | |
onCopy | (value: string) => void | Promise<void> |
Also accepts Omit<HTMLAttributes<HTMLSpanElement>, "onCopy">.
The ref reaches HTMLSpanElement.
| Keys | Does |
|---|---|
| Tab | Tab reaches the scrollable code and 44px copy button. |
| Enter, Space | Enter or Space requests clipboard copy from the focused button. |
The same styles are available as CSS. Native HTML provides the static presentation; React or application code supplies state updates and actions.
npm install @noorddev/vlak
import "@noorddev/vlak/css";
<figure class="rs-snippet" aria-label="Install command"><span class="rs-snippet-prefix" aria-hidden="true">$</span><code class="rs-snippet-code" tabindex="0">pnpm add @noorddev/vlak-react</code></figure>