Code Block
A monospace block for commands and output, with a copy button.
sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300<CodeBlock
label="Deploy command"
code="sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300"
/>Props
Installation
npx shadcn@latest add https://sproutboat.com/ikada/r/code-block.jsonThe CLI writes components/ikada/code-block.tsx and merges the ikada theme into your CSS. It also installs the components it is built from: Icon Button and Inline Confirm. Or take it from the package: import { CodeBlock } from "@sproutboat/ikada";
Usage
import { CodeBlock } from "@/components/ikada/code-block";
<CodeBlock
label="Deploy command"
code="sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300"
/>Examples
sproutboat deploy robin --region eu-west<CodeBlock
label="Deploy command"
code="sproutboat deploy robin --region eu-west"
/>sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300<CodeBlock
label="Deploy command"
code="sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300"
/>sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300<CodeBlock
label="Deploy command"
code="sproutboat deploy robin --region eu-west --env production --message 'Ship the new checkout flow' --wait --timeout 300"
wrap
/>✓ Built wren in 4.2s
✓ Uploaded 3 files
✓ Live at https://wren.sproutboat.app<CodeBlock
label="Deploy output"
copyable={false}
code={"✓ Built wren in 4.2s\n✓ Uploaded 3 files\n✓ Live at https://wren.sproutboat.app"}
/>Props
| Prop | Type | Description |
|---|---|---|
| coderequired | string | The text. It is shown as is and copied as is. |
| labelrequired | string | Names the block for screen readers, e.g. "Deploy command". Required. |
| wrap | boolean | Wrap long lines instead of scrolling sideways. Default `false`. |
| copyable | boolean | Hides the copy button. Default `true`. |
Also takes every prop of Omit<ComponentProps<"div">, "children">.
Source: src/components/code-block.tsx