# Toggle

A native button with a persistent pressed state.

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, Toggle } from "@flood-md/react";
import "@flood-md/react/styles.css";

export function Example() {
  return (
    <FloodRoot>
      <Toggle defaultPressed>Bold</Toggle>
    </FloodRoot>
  );
}
```

## Design notes

- Keep the accessible name stable; Enter/Space toggle pressed. Supports controlled pressed/onPressedChange or defaultPressed.

## API reference

| Prop | Values | Default |
| --- | --- | --- |
| `variant` | `"solid" \| "subtle" \| "outline" \| "ghost"` | `"subtle"` |
| `size` | `"2xs" \| "xs" \| "sm" \| "md" \| "lg" \| "xl" \| "2xl"` | `"md"` |
| `loading` | `boolean` | `—` |
| `pressed` | `boolean` | `—` |
| `defaultPressed` | `boolean` | `false` |
| `onPressedChange` | `(pressed: boolean) => void` | `—` |
| `iconOnly` | `boolean` | `false` |
| `Native HTML props` | `Omit<ButtonHTMLAttributes<HTMLButtonElement>, "aria-pressed" \| "type" \| "role" \| "defaultValue">` | `Forwarded` |
