# pressToggle

> Why JS: flipping `aria-pressed` the instant a ToggleButton is clicked needs a script to write the attribute back onto the host — the platform has no declarative way to toggle an ARIA state attribute on its own.

```ts
import { pressToggle } from "@sdxc/ui/mixins";
```

Flips a ToggleButton's `aria-pressed` attribute on every click and
dispatches PressToggleChangeEvent, keeping the attribute already
rendered onto the host as the single source of truth for pressed state.

## Signature

```ts
pressToggle(): MixinDescriptor<HTMLButtonElement>
```

Returns: A mixin descriptor for a ToggleButton's `mix` prop.

## Examples

```tsx
<button aria-pressed="false" mix={pressToggle()}>Mute</button>
```

## Used with it

The events, constants and types its module publishes, each imported from `@sdxc/ui/mixins` too.

### PressToggleChangeEvent

Dispatched on a ToggleButton by pressToggle right after a click
flips its `aria-pressed` attribute, carrying the value so a consumer can
persist it or mirror it onto another element without reading it back.

#### Signature

```ts
new PressToggleChangeEvent(pressed: boolean)
```

#### Properties

| Property | Type | Description |
| --- | --- | --- |
| `pressed` | `readonly boolean` | The host's `aria-pressed` value immediately after this click. |
