# @askrjs/askr/foundations/utilities

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

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

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

**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 16 exports from the declarations shipped by @askrjs/askr.

### `ariaDisabled`

```ts
ariaDisabled: (disabled?: boolean) => { "aria-disabled"?: "true"; }
```

Build an `aria-disabled` prop object; omitted entirely when `disabled` is falsy.

### `ariaExpanded`

```ts
ariaExpanded: (expanded?: boolean) => { "aria-expanded"?: "true" | "false"; }
```

Build an `aria-expanded` prop object; omitted when `expanded` is `undefined`.

### `ariaSelected`

```ts
ariaSelected: (selected?: boolean) => { "aria-selected"?: "true" | "false"; }
```

Build an `aria-selected` prop object; omitted when `selected` is `undefined`.

### `composeHandlers`

```ts
composeHandlers: <A extends readonly unknown[]>(first?: (...args: A) => void, second?: (...args: A) => void, options?: ComposeHandlersOptions) => (...args: A) => void
```

Compose two optional event handlers into one, running `first` then
`second` unless `first` marked the event as default-prevented.

### `ComposeHandlersOptions`

```ts
ComposeHandlersOptions: any
```

Options for {@link composeHandlers}.

- `checkDefaultPrevented`: When true (default), do not run the second handler if the first prevented default.
When false, always run both handlers.

### `composeRefs`

```ts
composeRefs: <T>(...refs: Array<Ref<T>>) => (value: T | null) => void
```

Combine multiple refs into one callback ref that writes to all of them.

### `DefaultPreventable`

```ts
DefaultPreventable: any
```

Minimal shape of an event that can be prevented from its default action.

- `defaultPrevented`: defaultPrevented?: boolean;

- `preventDefault`: preventDefault?: () => void;

### `FocusLikeEvent`

```ts
FocusLikeEvent: any
```

Structural subset of a focus event, for handlers that accept native or synthetic events.

- `relatedTarget`: relatedTarget?: unknown;

### `formatId`

```ts
formatId: (options: FormatIdOptions) => string
```

formatId

Formats a stable ID from a caller-provided identity.
- Pure and deterministic (no time/randomness/global counters)
- SSR-safe

POLICY DECISIONS (LOCKED):

1. No Auto-Generation
   Caller must provide the `id`. No random/sequential generation.
   This ensures determinism and SSR safety.

2. Format Convention
   IDs are formatted as `{prefix}-{id}`.
   Default prefix is "askr".

3. Type Coercion
   Numbers are coerced to strings via String().
   This is deterministic and consistent.

### `FormatIdOptions`

```ts
FormatIdOptions: any
```

Options for {@link formatId}.

- `prefix`: Defaults to 'askr'

- `id`: Stable, caller-provided identity

### `KeyboardLikeEvent`

```ts
KeyboardLikeEvent: any
```

Structural subset of a keyboard event, for handlers that accept native or synthetic events.

- `key`: key: string;

- `currentTarget`: currentTarget?: unknown;

- `target`: target?: unknown;

### `mergeProps`

```ts
mergeProps: <TBase extends object, TInjected extends object>(base: TBase, injected: TInjected) => TInjected & TBase
```

Merge `base` props over `injected` props: non-handler keys in `base` win,
and matching event handlers are composed (`injected` runs first).

### `PointerLikeEvent`

```ts
PointerLikeEvent: any
```

Structural subset of a pointer event, for handlers that accept native or synthetic events.

- `target`: target?: unknown;

### `PropagationStoppable`

```ts
PropagationStoppable: any
```

Minimal shape of an event whose propagation can be stopped.

- `stopPropagation`: stopPropagation?: () => void;

### `Ref`

```ts
Ref: ((value: T | null) => void) | {
  current: T | null;
} | null | undefined
```

A callback ref, an object ref, or a nullish value (no-op).

### `setRef`

```ts
setRef: <T>(ref: Ref<T>, value: T | null) => void
```

Write `value` to a {@link Ref}, ignoring failures on readonly object refs.

## Documentation navigation

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