function useRoomBeside
useRoomBeside(
el: HTMLElement | null,
): number | null

Returns the width el has to itself in a row it shares with an element that comes first, such as the tabs that leave room for the presence avatars. The first element counts at its content's natural width, since that depends on the theme's fonts and the locale, and the row's gap is taken off too. It returns null until measured.

It takes the element itself, from a callback ref, so that the measuring starts whenever it mounts. The element's own width doesn't enter into it, so it can size itself to the answer without feedback.

Parameters

el: HTMLElement | null

Return Type

number | null

Usage

import { useRoomBeside } from "src/hooks/shared/useRoomBeside.ts";