Skip to content

Collection Item state props for focus, disabled, hover, selected, etc #1501

Closed
@AndyOGo

Description

🙋 Feature Request

Im using the dynamic <Item> collection component to render custom JSX for a <ListBox disabledKeys={[...]}> option.

E.g.:

<ListBox items={animals}>{(item) => (
<Item>
  <div classNames={item.disabled ? "" : ""}>{item.name}</div>
  <div classNames={item.disabled ? "" : ""}>{item.describtion}</div>
</Item>
)}</ListBox>

Unfortunately I cant access some state of the rendered item, like disabled, selected, focus, hover, etc.
It would be great to have access to these information, so that I can change the styling for example.

🤔 Expected Behavior

Dynamic <Item> components should have access to all state information.

😯 Current Behavior

Can't access any state in dynamic <Item> components.

💁 Possible Solution

Forward state from useListState

🔦 Context

Can't apply custom styling for options in various states.

💻 Examples

🧢 Your Company/Team

🎁 Tracking Ticket (optional)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationhelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions