# ThemeToggle

Small, generic Fresh island for dark/light theme switching.

[All components](https://rickylabs.github.io/netscript/design-system/components/) · [Theme builder](https://rickylabs.github.io/netscript/create/) · [Implementation source](https://github.com/rickylabs/netscript/blob/main/packages/fresh-ui/registry/islands/ThemeToggle.tsx)

## Live preview

[Open live theme-toggle preview](https://rickylabs.github.io/netscript/assets/fresh-ui/preview/?component=theme-toggle&theme=studio-utility)

## Install

```bash
netscript ui:add theme-toggle
```

## Usage and examples

The preview runs this JSX with the installed components. Import any composed primitives from your UI directory.

```tsx
import { useState } from 'preact/hooks';
import ThemeToggle from '@app/islands/ui/ThemeToggle.tsx';

export function Example() {
  const [value, setValue] = useState('standard');
  const [open, setOpen] = useState(false);
  const [notice, report] = useState('');
  return (<><div><ThemeToggle /></div><p role="status">{notice}</p></>);
}
```

## Props

Generated from native `deno doc --json --private` over the shipped implementation. Compound component props retain their owning interface; native attributes pass through where declared.

No locally declared props; see the implementation source for native pass-through attributes.

## Keyboard

| Key | Action |
| --- | --- |
| `Enter` | Activate |
| `Space` | Activate button; links use native Enter |

## Tokens

Semantic contract roles: `surface/card`, `text/fg`.

CSS custom properties referenced directly: `--ns-border`, `--ns-border-hover`, `--ns-control-height`, `--ns-fg`, `--ns-focus-ring-offset`, `--ns-focus-ring-width`, `--ns-muted-fg`, `--ns-radius-control`, `--ns-radius-md`, `--ns-ring`, `--ns-surface-raised`.

## Contract and compatibility

Accessibility pattern: [WAI-ARIA guidance](https://www.w3.org/WAI/ARIA/apg/patterns/button/)

- Native DOM attributes pass through where the implementation accepts them.

Design contract values marked planned are not implementation props. The props above describe what ships today.
