Snippet
One command to copy and paste: an install, a login, a link. The prompt is not copied, and on phones it wraps.
import { Snippet, SnippetSkeleton } from '@sypnia/ui/react'
Commands to copy
Long commands wrap instead of hiding their end.
Code
import { Snippet } from '@sypnia/ui/react';
// One command to copy. The $ is not copied, so it can be pasted straight into a terminal.
export default function Install() {
return (
<div className="sy-stack">
<Snippet code="npm install @sypnia/ui" label="install command" />
<Snippet code="sypnia login --token $SYPNIA_TOKEN --project storefront --region sa-east-1" label="login command" />
</div>
);
} Skeleton
The real piece and its skeleton: the same box, so nothing moves when the data arrives.
Code
import { Snippet, SnippetSkeleton } from '@sypnia/ui/react';
// While the command is being prepared (a token, a project id).
export default function Skeleton() {
return (
<div className="sy-stack">
<Snippet code="npx sypnia link prj_8f2c1a9e4b" label="link command" />
<SnippetSkeleton />
</div>
);
} When to use it
Use it when
- A single command the person runs as it is.
Do not use it when
- There are several lines or a file: CodeBlock.
- It is the result of a command: Terminal.
For everyone
- The Copy button says what it copies when you give it a
label: «Copy install command».
Props
| Snippet | Type | Default |
|---|---|---|
coderequired | string | |
label | string | |
prompt | string | $ |