# @askrjs/askr/foundations/interactions

> Published API exports for @askrjs/askr/foundations/interactions.

Source: [https://askrjs.com/docs/reference/api/askr/foundations--interactions](https://askrjs.com/docs/reference/api/askr/foundations--interactions)

Status: stable. Packages: @askrjs/askr/foundations/interactions.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 18 exports from the declarations shipped by @askrjs/askr.

### `applyInteractionPolicy`

```ts
applyInteractionPolicy: ({ isNative, disabled, onPress, ref }: InteractionPolicyInput) => { disabled: true | undefined; onClick: (e: Event) => void; ref: Ref<unknown>; } | { tabIndex: number; ref: Ref<unknown>; "aria-disabled"?: "true"; onClick: (e: DefaultPreventable & PropagationStoppable) => void; disabled?: true; role?: "button"; onKeyDown?: (e: KeyboardLikeEvent) => void; onKeyUp?: (e: KeyboardLikeEvent) => void; }
```

THE interaction policy. Components MUST use this, NEVER implement
interaction logic directly.

### `dismissable`

```ts
dismissable: ({ node, additionalInsideNodes, disabled, onDismiss }: DismissableOptions) => { onKeyDown: (e: KeyboardLikeEvent) => void; onPointerDownCapture: (e: PointerLikeEvent) => void; }
```

Produce keydown/outside-click props that invoke `onDismiss` on Escape or an outside click.

### `DismissableOptions`

```ts
DismissableOptions: any
```

Options for {@link dismissable}.

- `node`: Reference to the protected element for outside click detection. Attach the
returned capture props to a surface that encloses this node.

- `additionalInsideNodes`: Additional roots that are logically inside the protected surface even
when a portal places them outside `node` in the DOM tree.

- `disabled`: Whether dismiss is disabled

- `onDismiss`: Called when dismiss is triggered (Escape or outside click)

### `focusable`

```ts
focusable: ({ disabled, tabIndex }: FocusableOptions) => FocusableResult
```

Normalize `tabIndex`/`aria-disabled` props for a focusable host.

### `FocusableOptions`

```ts
FocusableOptions: any
```

Options for {@link focusable}.

- `disabled`: disabled?: boolean;

- `tabIndex`: tabIndex?: number | undefined;

### `FocusableResult`

```ts
FocusableResult: any
```

Element props returned by {@link focusable}.

- `tabIndex`: tabIndex?: number;

### `hoverable`

```ts
hoverable: ({ disabled, onEnter, onLeave }: HoverableOptions) => HoverableResult
```

Produce pointer enter/leave props that call `onEnter`/`onLeave` unless disabled.

### `HoverableOptions`

```ts
HoverableOptions: any
```

Options for {@link hoverable}.

- `disabled`: disabled?: boolean;

- `onEnter`: onEnter?: (e: HoverEvent) => void;

- `onLeave`: onLeave?: (e: HoverEvent) => void;

### `HoverableResult`

```ts
HoverableResult: any
```

Element props returned by {@link hoverable}.

- `onPointerEnter`: onPointerEnter?: (e: HoverEvent) => void;

- `onPointerLeave`: onPointerLeave?: (e: HoverEvent) => void;

### `InteractionPolicyInput`

```ts
InteractionPolicyInput: any
```

Input to {@link applyInteractionPolicy}.

- `isNative`: Whether the host element is a native interactive element (button, a, etc)

- `disabled`: Disabled state - checked ONLY here, never in components

- `onPress`: User-provided press handler - semantic action, not DOM event

- `ref`: Optional ref to compose

### `mergeInteractionProps`

```ts
mergeInteractionProps: (childProps: Record<string, unknown>, policyProps: Record<string, unknown>, userProps?: Record<string, unknown>) => Record<string, unknown>
```

Merge rule for Slot / asChild

Precedence:
  policy → user → child

Event handlers are composed (policy first).
Refs are always composed.
Policy props MUST take precedence to enforce invariants.

### `Orientation`

```ts
Orientation: 'horizontal' | 'vertical' | 'both'
```

Arrow-key axis for {@link rovingFocus}.

### `pressable`

```ts
pressable: ({ disabled, onPress, isNativeButton }: PressableOptions) => PressableResult
```

Produce click/keyboard props implementing 'press' semantics for an element.

### `PressableOptions`

```ts
PressableOptions: any
```

Options for {@link pressable}.

- `disabled`: disabled?: boolean;

- `onPress`: onPress?: (e: PressEvent) => void;

- `isNativeButton`: Whether the host is a native button. Defaults to false.

### `PressableResult`

```ts
PressableResult: any
```

Element props returned by {@link pressable}.

- `onClick`: onClick: (e: PressEvent) => void;

- `disabled`: disabled?: true;

- `role`: role?: 'button';

- `tabIndex`: tabIndex?: number;

- `onKeyDown`: onKeyDown?: (e: KeyboardLikeEvent) => void;

- `onKeyUp`: onKeyUp?: (e: KeyboardLikeEvent) => void;

### `rovingFocus`

```ts
rovingFocus: (options: RovingFocusOptions) => RovingFocusResult
```

Implement arrow-key roving tabindex navigation over a set of items.

### `RovingFocusOptions`

```ts
RovingFocusOptions: any
```

Options for {@link rovingFocus}.

- `currentIndex`: Current focused index

- `itemCount`: Total number of items

- `orientation`: Navigation orientation
- horizontal: ArrowLeft/ArrowRight
- vertical: ArrowUp/ArrowDown
- both: all arrow keys

- `loop`: Whether to loop when reaching the end

- `onNavigate`: Callback when navigation occurs

- `isDisabled`: Optional disabled state check per index

### `RovingFocusResult`

```ts
RovingFocusResult: any
```

Container and per-item props returned by {@link rovingFocus}.

- `container`: Props for the container element (composes via mergeProps)

- `item`: Generate props for an item at the given index (composes via mergeProps)

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/askr/foundations--utilities/index.md) | [Next](https://askrjs.com/docs/reference/api/askr/foundations--state/index.md)
