Components
Copy field
Hand over a value with one clear copy action, inline, in a field, or in a titled code block.
import { … } from "@fungi.computer/caps/components/copy-field";Command
import { CopyField } from "@fungi.computer/caps/components/copy-field";
export default function Command() { return <CopyField value="npx fungi forage --nearby" />;}Api key field
import { CopyField } from "@fungi.computer/caps/components/copy-field";
export default function ApiKeyField() { return ( <CopyField displayValue="sk_live_••••••••ab" fieldLabel="API key" label="Copy key" value="sk_live_8f2c9139ab" /> );}Code block
import { CopyField, type CopyFieldToken,} from "@fungi.computer/caps/components/copy-field";
const tokens: CopyFieldToken[] = [ { kind: "tag", text: "<Mushroom " }, { kind: "attribute", text: "species" }, { kind: "text", text: "=" }, { kind: "string", text: '"chanterelle"' }, { kind: "tag", text: " />" },];
export default function CodeBlock() { return <CopyField layout="block" title="JSX" tokens={tokens} />;}Props
CopyFieldProps
| Prop | Type | Description |
|---|---|---|
label? | string | Copy action text; the code presentations default to "Copy". |
label?stringCopy action text; the code presentations default to "Copy".
Full types: API reference.