Skip to content

Promote useViewportSize to a public, documented hook #9904

@onlywei

Description

@onlywei

🙋 Documentation Request

useViewportSize is exported from @react-aria/utils and usable by consumers, but it has no documentation page and its source lives under the private/ folder within the package. This sends mixed signals about whether it's intended for external use or could change without notice.

The ask

  • Add a documentation page to the React Aria docs site (usage, SSR behavior, return type)
  • Clarify the hook's public API status — if the private/ source directory is just organizational and not a stability signal, a docs page would resolve that ambiguity on its own

Context

Multiple SSR-related issues (#4676, #4921, #5057) have been filed by consumers who discovered this hook through Modal and Popover internals. People are already depending on it and would benefit from official guidance. It's also a notably better alternative to popular community hooks like usehooks-ts/useWindowSize thanks to its visualViewport usage, but there's no way to discover that without reading the source.

🧢 Your Company/Team

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions