adobe / adobe/react-spectrum

[Table] Expose `ColumnResizerContext` and other contexts from RAC

Open
#7,733 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
15.9k
Forks
1.6k
Avg merge
3d 9m
Merged PRs (30d)
59

Description

### Provide a general summary of the feature here

Hi team. I've been trying to replicate RAC Table components based on `react-aria` hooks since I'd like to get access to internals like `column.index` from inside the `Column` component.

As far as I'm aware, it's not possible to get access to that just by using RAC components. We need to drop a layer down and use hooks combined with `createLeafComponent`, basically replicating what's already implemented in RAC.

What's blocking me currently from doing that is access to some internal contexts that **are not exported** from RAC, in case of column e.g `ColumnResizerContext`. I wouldn't mind also getting access to `ResizableTableContainerContext`.

### 🤔 Expected Behavior?

All contexts in `Table.tsx` are exported to allow consumption from outside of RAC.

### 😯 Current Behavior

Only part of contexts (e.g `TableContext`) are exposed.

### 💁 Possible Solution

Expose contexts. Alternatively, provide ways to access internal data like e.g `column.index` from inside of `Column` component.

Maybe there's already an existing way to achieve it? Like wrapping RAC components in another layer of `createLeafComponent`?

### 🔦 Context

I'm trying to implement some responsive features like e.g column dropping based on table width. This needs to be done generically with respect to how those Tables can be constructed based on RAC documentation (render props, created statically etc.).

### 💻 Examples

_No response_

### 🧢 Your Company/Team

_No response_

### 🕷 Tracking Issue

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.