# CodeSnippet

Selectable, wrapping code with an optional host-owned action.

Connect Flood once using [the installation guide](https://flood.md/docs/installation). Then import the components you use; no per-component add command is needed.

## Example

```tsx
"use client";

import { FloodRoot, CodeSnippet } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <CodeSnippet code="git status --short" />
    </FloodRoot>
  );
}
```

## Design notes

- CodeSnippet escapes code content and uses the semantic system monospace font stack.
- The host implements copy behavior, failure handling and feedback. No clipboard or network API runs inside the component.
- Code text defaults to LTR independently of parent layout. codeDirection can be ltr/rtl/auto; native dir still controls the wrapper and action layout.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `code` | `string` | `Required` |
| `codeDirection` | `"ltr" \| "rtl" \| "auto"` | `"ltr"` |
| `action` | `ReactNode` | `—` |
| `Native HTML props` | `Omit<HTMLAttributes<HTMLDivElement>, "children">` | `Forwarded` |
