# @spark-web/utils

> --- title: Utilities isExperimentalPackage: true ---

Latest version **5.1.0** (published 2026-01-15) · 0 weekly downloads

## Install

```sh
npm install @spark-web/utils
pnpm add @spark-web/utils
yarn add @spark-web/utils
bun add @spark-web/utils
```

## Health

**Score 55/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 5.1.0 |
| Published | 2026-01-15 |
| First published | 2022-04-20 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14 |
| Dependencies | 1 |
| Unpacked size | 41.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | brighte, brighte-release-bot |

## Links

- npm: https://www.npmjs.com/package/@spark-web/utils
- Repository: https://github.com/brighte-labs/spark-web
- Homepage: https://github.com/brighte-labs/spark-web#readme
- Issues: https://github.com/brighte-labs/spark-web/issues
- npm.io page: https://npm.io/package/@spark-web/utils

## Dependencies (1)

- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.25.0

## Recent versions

- 5.1.0 (latest) — 2026-01-15
- 5.1.0-rc.0 (rc) — 2025-07-24
- 5.0.0 — 2025-02-10
- 5.0.0-rc.31 — 2025-02-10
- 5.0.0-rc.29 — 2025-02-06
- 5.0.0-rc.28 — 2025-02-06
- 5.0.0-rc.27 — 2025-02-05
- 5.0.0-rc.26 — 2025-02-05
- 5.0.0-rc.25 — 2025-01-31
- 5.0.0-rc.24 — 2025-01-20
- 2.0.0-rc.21 — 2025-01-07
- 2.0.0-rc.20 — 2025-01-07
- 2.0.0-rc.19 — 2024-12-12
- 2.0.0-rc.18 — 2024-12-12
- 2.0.0-rc.17 — 2024-12-12
- … 32 more at https://npm.io/package/@spark-web/utils/versions

## README

---
title: Utilities
isExperimentalPackage: true
---

🚧 — Under construction

## forwardRefWithAs

A best effort attempt to provide strongly typed polymorphic components that (as
the name suggests) forwards the ref onto the underlying element.

Internally this is used for our layout primitives (`Box`, `Columns`,
`Container`, `Hidden`, `Inline`, `Row` and `Stack`), our link components
(`Link`, `ButtonLink` and `TextLink`), our typographic components (`Heading` and
`Text`) and finally `VisuallyHidden`.

```jsx
export const PolymorphicComponent = forwardRefWithAs<
  'div',
  PolymorphicComponentProps
>(({ as: Tag = 'div', ...consumerProps }, forwardedRef) => {
  return (
    <Tag
      {...consumerProps}
      ref={forwardedRef}
      // Custom props go here
    />
  );
});
```

---
_Source: https://npm.io/package/@spark-web/utils · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
