whizkydee / dropd Goto Github PK
View Code? Open in Web Editor NEW⚡️Zero-dependency minimalistic dropdown component for React and Vue.
Home Page: https://npm.im/dropd-component
License: MIT License
⚡️Zero-dependency minimalistic dropdown component for React and Vue.
Home Page: https://npm.im/dropd-component
License: MIT License
By default, add a selected
class name to the currently selected item on the list to enable for styling and extra logic.
Make it possible for the user to completely take control of dropd-list
, dropd-item
and dropd-toggle
via Vue slots and a similar workaround in React, with relevant props bound to them.
<Dropd {...props}>
<Dropd.List>
...
<Dropd.Item>
...
</Dropd.Item>
</Dropd.List>
<Dropd.Toggle>
...
</Dropd.Toggle>
</Dropd>
<dropd {...props}>
<ul slot="dropd-list">
...
<li slot="dropd-item">
...
</li>
</ul>
<button slot="dropd-toggle">
...
</button>
</dropd>
Right now, a couple of things are missing in terms of accessibility of the elements. These include:
We should fix this.
Add a revealOn
prop which would accept either mousedown
or mouseover
values (with default set to mousedown
), and would only trigger dropd on that event.
Add a noDuplicates
prop which would ensure that all items in the list
prop is unique.
Already started working on it -- was good for an array of strings, but requires extra logic to filter duplicates from an array of objects.
These lines: react-dropd/index.js#L80-L81 and vue-dropd/index.vue#L149-L50 are totally irrelevant, and they have adverse effects...
For instance, when an <input>
is focused, the event is prevented, so focus doesn't actually happen.
Also, it prevent's closeDropd
on mousedown
for all other dropdowns.
Hi @whizkydee, thanks for putting this great library!
I couldn't find any instruction on customizing the style, how do you recommend doing it?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.