# OptimisticToggle

> Client island: an on/off control (read, saved, starred) that is a real POST form.

```ts
import { OptimisticToggle } from "@sdxc/ui/app";
```

Renders the form and its toggle button, with both states' content in the markup so a
flip is a change of `data-pressed` on the form.

## Examples

```tsx
<OptimisticToggle action={`/posts/${post.id}/star`} name="starred" pressed={post.starred}
	fields={{ returnTo: url.pathname }} labels={{ label: "Star", failed: "Failed" }}
	pressedContent={<StarIcon fill="currentColor" />} unpressedContent={<StarIcon />} />
```

## Props

Takes no props of its own.
