List component
#1495
Replies: 1 comment
-
@mslizh If you need a list, you can use the select machine. const [state, send] = useMachine(
select.machine({
// ...
open: true,
"open.controlled": true,
})
);
const api = select.connect(state, send, normalizeProps);
return (
<div {...api.rootProps}>
<ul {...api.contentProps} style={{ height: "300px" }}>
{selectData.map((item) => (
<li key={item.value} {...api.getItemProps({ item })}>
<span {...api.getItemTextProps({ item })}>{item.label}</span>
<span {...api.getItemIndicatorProps({ item })}>✓</span>
</li>
))}
</ul>
</div>
); CleanShot.2024-05-15.at.10.44.50.mp4 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
🚀 Feature request
Add a component for a list that allows keyboard navigating, adding, deleting, selecting (one or more) and dragging and dropping items. Some of the functionality should be similar to the way lists work in Combobox, Select, Menu, etc.
🧱 Problem Statement / Justification
Because it's a popular functionality in many applications that has to be constantly re-implemented. Keyboard functionality are often forgotten.
✅ Proposed solution or API
Sorry, I'm a beginner so I don't have any.
↩️ Alternatives
React Aria List Box
📝 Additional Information
Beta Was this translation helpful? Give feedback.
All reactions