Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tabs] Missing width/height state in Tabs.Indicator render callback #1286

Closed
aarongarciah opened this issue Jan 5, 2025 · 0 comments · Fixed by #1288
Closed

[Tabs] Missing width/height state in Tabs.Indicator render callback #1286

aarongarciah opened this issue Jan 5, 2025 · 0 comments · Fixed by #1288
Assignees
Labels
component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature

Comments

@aarongarciah
Copy link
Member

aarongarciah commented Jan 5, 2025

Feature request

Summary

The Tabs.Indicator element exposes the following CSS vars in order to let users style/animate the element:

--active-tab-top
--active-tab-right
--active-tab-bottom
--active-tab-left

--active-tab-width
--active-tab-height

The state argument in the render callback of the Tabs.Indicator component includes a selectedTabPosition object which contains {top, right, bottom , left}. These coordinates correspond to the first four CSS vars, but --active-tab-width and --active-tab-height have no corresponding state keys.

Motivation

Some users might need to access the width/height of the selected tab in JS. For example, it's useful if someone is relying on Motion to animate the tabs indicator. See this example: https://codesandbox.io/p/sandbox/black-platform-4zphr8?workspaceId=ws_HE9JRzFW36Y2kpBoSwdvZ5. The coordinates of the tabs indicator can be animated using Motion but not the width because width/height is not exposed in the render callback state.

Further context: https://discord.com/channels/1287292451308048406/1287292451308048409/1325583630956888135

@aarongarciah aarongarciah added the component: tabs This is the name of the generic UI component, not the React module! label Jan 5, 2025
@aarongarciah aarongarciah changed the title [Tabs] Expose width/height in Tabs.Indicator render callback state [Tabs] Expose width/height state in Tabs.Indicator render callback Jan 5, 2025
@aarongarciah aarongarciah changed the title [Tabs] Expose width/height state in Tabs.Indicator render callback [Tabs] Missing width/height state in Tabs.Indicator render callback Jan 6, 2025
@mj12albert mj12albert added the enhancement This is not a bug, nor a new feature label Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: tabs This is the name of the generic UI component, not the React module! enhancement This is not a bug, nor a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants